[SOLVED] Finding a number in a line of text

GarrowGlitch

  • Posts: 207
Hey all, im looking for a quick solution to find any number in a line of text Specifically in my list attribute. For instance i have "Metal50"...Say i want to replace the number with "xx" = Metalxx...
I want to know if there's maybe an extension or a behavior i'm missing? I'm trying to replace ANY number because this number can literally be anything. THANKS!!

« Last Edit: May 26, 2018, 07:00:24 am by GarrowGlitch »

JeffreyDriver

  • Posts: 1717
Will the format always be "TEXT NUMBER"?

If so, you can use the blocks under NUMBERS & TEXT > TEXT > SPLIT to separate the number.  Be sure to leave a space between them. You can stick these in a list so you can refer to them as needed.
Current Projects:
Retro Redux Compilation (NEW).
Retro Redux (untitled) (NEW).
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

GarrowGlitch

  • Posts: 207
I'd have to change a few things up because sometimes the text will be two words with a space.. Darn

Luyren

  • *
  • Posts: 1457
In the same place where you find the "split" blocks, there is a block that splits text into a list based on a separator. So if your separator is a comma, and your text is "Metal Block,99" (no space after your separator), it will return a list with items "Metal" and "99".  So you split the text, and use the "get item number # from list []" to get the number.

Example:
Get item 1 in list [split "Metal,99" with separator (,)]
This will return 99.

And if your text can use a comma in its name, just pick another separator. A separator can also be more than one character, if needed.
Working.

GarrowGlitch

  • Posts: 207
Hmm, that's a great idea, but i am using this text in a list of its own already. I think your idea is my best bet though. Thank you!

Luyren

  • *
  • Posts: 1457
Get item 1 in list [split "get item # from list" with separator (,)]
You can nest them as much as you want.
Working.

GarrowGlitch

  • Posts: 207
Yep, that's what i've done! Appreciate the help!