String number manipulation

Hi everyone

value=“marzo 2020”

I want to eliminate 2020 from my variable
is there any way
Thanks a lot

Hi @borismh,

You can use String manipulation to do this. By using Assign activity:-

value = value.Substring(0, “marzo”.Length)

Best,
Khairul

1 Like

@khairuln

I tried it and if it came out, but I would like to make it dynamic, because that value named “marzo” can change since I get it with a get text

Is your string always containing marzo or can be any other month? If the year will always be the current one, will be safer to use like this:
value2 = value.Replace(Now.ToString("yyyy"),"").Trim

1 Like

@bcorrea

my “value” is a string variable, extracted by a get text, that code does not work in this I think

It will work fine, you can either create a new string variable or use the same one…

I believe the suggestion should work for you. Or is it always changed the value 2020?

As such, can it be different like “marzo 2020”, “abx 2019”…??

@bcorrea


@khairuln

just change the value “marzo” 2020 does not change

sorry, i missed the To in ToString there…
value2 = value.Replace(Now.ToString("yyyy"),"").Trim

@bcorrea

one more question

I want to extract in Spanish the value of the current month

mounth = Now.ToString (“MMMM”)

but he extracts me in English

it is possible to have this data in Spanish

Thanks a lot

month = Now.ToString("MMMM", System.Globalization.CultureInfo.CreateSpecificCulture("es-ES"))

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.