Disp selected characters


#1

hi

i have string “Venkat” i need to disp only first 2 characters “Ve”

how to disp pls help me

thank you


#2

Use string function like substring.


#3

sorry
actually i don’t know how to write substring function in uipath
can u pls send me the substring


#4

string str = yourStringVariable.Substring(0,2)

  1. Use Assign Activity.
  2. on the left side hit ctrl+k and give a name str.
  3. Go to down variable pane and change the str variable type to string.
  4. Assign right side ** yourStringVariable.Substring(0,2)**
  5. Write line your str variable.

Regards…!!
Aksh


#5

check this workflowsubstring.xaml (4.9 KB)


#6

tysm!! its working now


#7

thanq


#8

Just in case another person wants an alternative a .left() function will also work.This outputs a specified number of characters starting from the left hand side of the string. There is also .right() which, as you can imagine, goes from the right hand side of the string.

so instead you may want it to be

a=“VenkatP”

b = a.left(2) // outputs as “Ve”

Thanks


#9

@jakelewis18 Hi, it doesn’t work. There are no such functions under string


#10

If you wnat use left method:
“variable” = Left(“variable”, “lenght”)
@sangasangasanga


#11

@pllo2ptk
I tried using Assign
text = Left(“hello”, “length”)
Gives me error: Options strict on disallows implicit conversions from ‘string’ to ‘integer’


#12

Check variable type of TEXT -> must be string
Example

text = left(“aaaa”, 2)