# Splitting Text

If I have “Soda|2” and want to split this out to “Soda” and “2”, how would I go about that?

Why |? Is this for Inform 6 or 7?
If it’s for Inform 7, here’s some vague help: “Indexed text” seems appropriate for splitting text.

I think I got it. I replaced “|” with " ", then I could refer to word 2 and word 1 and bam!

And now on to more questions! Turn text “3” to number 3. I feel bad for not finding this in the help files.

I’ve used this algorithm which is originally from Guncho:

```To decide which number is numeric/numerical value of (T - text): let S be 1; let L be the number of characters in T; if L is 0, decide on 0; let negated be false; if character number 1 in T is "-" begin; let negated be true; let S be 2; end if; let result be 0; repeat with N running from S to L begin; let C be character number N in T; let D be 0; if C is "1" begin; let D be 1; otherwise if C is "2"; let D be 2; otherwise if C is "3"; let D be 3; otherwise if C is "4"; let D be 4; otherwise if C is "5"; let D be 5; otherwise if C is "6"; let D be 6; otherwise if C is "7"; let D be 7; otherwise if C is "8"; let D be 8; otherwise if C is "9"; let D be 9; otherwise if C is "0"; let D be 0; otherwise; decide on 0; end if; let result be (result * 10) + D; end repeat; if negated is true, let result be 0 - result; decide on result.```

At this point I’d like to ask for some context for what you’re trying to do, because usually when you’re trying to convert text numbers into actual numbers, you’re doing something really wrong.

That worked delightfully, thank you.

And I’m raping Inform. It’s what I do. If a given expansion of the game doesn’t do at least two things Inform was not meant to do? I don’t feel I’ve gotten anything done.

In this specific case, save files that work between versions of the game to store your inventory. Almost perfectly working, and I think I can get that last 2% done.