ieptus
(david aston)
1
Hi all, I have used GET TEXT to import a name into a variable. The name looks something like this
joe h. bloggs I have use LEFT/RIGHT to try to get the last part of the name (bloggs) as a new variable, however I keep getting a blank result
i.e
Full Text = Test (Contains the Name) - I have checked its populated using message box
Seperator = " "
I think there is a blank space at the end of the name so when trying to get a LEFT result I end up with nothing
How do I trim the end of the text
PLEASE NOTE this is studioX and not studio
Any help would be appreciated
Hi
Try this in assign or a previous step.
“YOURVARIABLE.trim.tostring”
You could also try using Regex to grab the last word and then trim that also:
See this link for a preview
ieptus
(david aston)
3
Thanks for the reply, StudioX doesnt have an assign (studio does) where would I put this?
You should be able to use the “trim” function in the output/result field of the get text.
Remember you can use “ctrl + space” to see that syntax options you have available. Look for “trim” then “tostring”
ieptus
(david aston)
5
I have this
Saved.Values(Of System.String)(“Test”). you cant add trim to this, im confused
Hi again
Can you try this solution:
But use this Regex pattern:
\w+(?=\s*$)
Regex.Match(Saved.Values(Of String)(“StrInput”),” \w+(?=\s*$)").Value
ieptus
(david aston)
7
Hi thanks, I have seen that previously, however regex is not a menu option in studioX
ieptus
(david aston)
8
Hold on, I may have been too quick with that reply, apologies
ieptus
(david aston)
9
So added a write line activity plus the code you gave me thank you, i get this
REGEX is not declared error message
Please try this…
system.text.regularexpressions.Regex.Match(Saved.Values(Of String)("StrInput"),” \w+(?=\s*$)").Value
ieptus
(david aston)
11
that got rid of the error thank you
ieptus
(david aston)
12
Where does the result get recorded?
You can use “Save for Later activity” and save the output to another variable.
ieptus
(david aston)
14
HI, thanks for the reply, the Write Line activity does not have a save for later option, or am i missing something?
ieptus
(david aston)
15
sorry not awake yet, understand what you mean
system
(system)
Closed
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.