I have users who are tapping enter twice at the end of an address field and when I am concatenating the street with the city I get blank lines in the address which is causing an issue with checks. I was attempting to fix it with replacing line breaks but couldn't get the desired result. Is there a way to scan each line and remove it if it is doesn't have any text?
*This post is locked for comments
Thank you!
Changed it around a little bit and added the loop for when they eventually add 2 carriage returns.
while (substr(Street, strlen(Street),1) == "\n")
{
Street = substr(Street, 1, strlen(Street) -1);
}
This is a common problem with user pressing carriage return at the end of the address.
If you want to look if the last two characters in the street address is a carriage return then use the following:
if(substring(Street, len(Street) - 2, 2) == "\r\n")
{
street = substring(street, 1, len(street) - 2));
}
You need to check, as I am not on a system at the moment, but you might need to use 1 character and \n rather than \r\n, can remember if it uses both or just \n.
This will of course only check the last characters for returns. If the user pressed it multiple times, you might want to run a loop to check you get them all.
Please mark this as an answer if you found the information useful.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156