Jump to content
UBot Underground

Variable Equals Alphabetic Character


Recommended Posts

I am pulling in a string from a table and attempting to look at a text string to identify if it starts with an alphabetic character (i.e. A-Z), and if it does I want to insert a space (i.e. " ").  I was attempting to do this with a regular expression, but I must be missing something, below is a snippet of the code I am using.  I think I must be missing something in how I am attempting to identify the alphabetic characters.  Any help would be greatly appreciated.

 

set(#SomeTextString, $table cell(&SomeTable, #SpecificRecord, 4), "Global")
            set(#1stLetterSomeTextString, $substring(#SomeTextString, 0, 1), "Global")
            if($find regular expression(#1stLetterSomeTextString, "[A-Z]")) {
                then {
                    set(#SomeTextString, $insert text(#SomeTextString, " ", 0), "Global")
                }
                else {
                    set(#SomeTextString, $table cell(&SomeTable, #SpecificRecord, 4), "Global")
                }
            }
Link to post
Share on other sites

You can't just use "find regular expression" inside if condition...if text that regex returns is different than "True",  bot will always go into else statement (this is what happens in your case, that's why insertion doesn't work).

 

This is how you do it properly:

set(#SomeTextString, "Test", "Global")
set(#stLetterSomeTextString, $substring(#SomeTextString, 0, 1), "Global")
if($comparison($text length($find regular expression(#stLetterSomeTextString, "[A-Z]")), ">", 0)) {
    then {
        set(#SomeTextString, $insert text(#SomeTextString, " ", 0), "Global")
    }
    else {
    }
}
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...