The Dink Network

Reply to Re: Strings in Dink

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
November 6th 2008, 02:09 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
This really looks like you've only read my short answer <_<

And, sure, it's possible. The input is not too difficult, but still not what I'd consider "everyday DinkC scripting". Output in the middle of a string is nearly impossible for the reasons you mentioned. There's no straightforward way to determine the length of the string.

Well, there is:

int &string = 76763;

int &length = 0;
int &crap = &string;
loop:
if (&crap > 0)
{
&length++;
&crap = &crap / 26;
goto loop;
}
say("&length",1);

With the example string, this would result in

76763 > 0 -->
&length = 1; &crap = 2952;
2952 > 0 -->
&length = 2; &crap = 113;
113 > 0 -->
&length = 3; &crap = 4;
4 > 0 -->
&length = 4; &crap = 0;
0 <= 0 -->
say("4",1);