Ask Your Question
0

Extrapolate part from string variable

asked 2017-06-22 10:12:07 +0200

Fede gravatar image

updated 2017-06-22 10:13:11 +0200

Hello!

If I have a string variable (ex "A25") and i Would like to extract only "25" from this string, I have to use the "MID" function of calc with the command call.function?

callfunction("MID",....)

Thanks in advance

Good Life

LO: 5.2 and 5.3

SO: Windows 7 and 10

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2017-06-22 10:37:59 +0200

pierre-yves samyn gravatar image

Hi

With EditFind & Replace:

  • Find: \D
  • Replace: nothing (keep empty)
  • Other options: tick Regular expressions

Explanation: \D Match any character that is not a decimal digit.

Regards

edit flag offensive delete link more

Comments

Sorry, I wan not clear

In Starbasic, I have a string variable

dim s$ s = "A25"

So I would like to define a second variable that contain a parte of the string "s"

dim s2$ s2 = "25"

Is there a function that allow to extrapolate "25" from the string "s"? [so s2 = f (s)]

Thank you

Fede gravatar imageFede ( 2017-06-22 13:28:21 +0200 )edit

s2 = Right( s, 2 ) REM take the last two characters of s.

or:

s2 = Mid( s, 2 )    REM take all characters from s, starting at the second character.
librebel gravatar imagelibrebel ( 2017-06-22 14:07:26 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-06-22 10:12:07 +0200

Seen: 61 times

Last updated: Jun 22 '17