Jump to content
UBot Underground

Ubot Studio Tutorial: Remove Extra Spaces From Text (Function)


Recommended Posts

Thanks acamso, 

 

But with regex

\s+

you are matching whitespace character which is space, tab, newline, and carriage return

 

with your function above, all newline and carriage return also will be replace with space right ?

How to remove extra spaces only, in every line, without removing tab, newline, and carriage return ? 

Link to post
Share on other sites

Basically you might want to use a "replace" function or command. You can search for plain text patterns like "  " (double space) and replace it with a single space " " or even with "$nothing" to replace the found pattern with nothing. You could also use some RegEx Replace function, if it better suits your needs. You can execute multiple replace commands/functions in a sequence.

Link to post
Share on other sites
  • 4 months later...

Thanks acamso, 

 

But with regex

\s+

you are matching whitespace character which is space, tab, newline, and carriage return

 

with your function above, all newline and carriage return also will be replace with space right ?

How to remove extra spaces only, in every line, without removing tab, newline, and carriage return ? 

 

Yes this function is intended for a string without new lines. I'll make one with new lines included.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...