Page 1 of 1

Odd Request (Splitting string in C++)

Posted: Sun Sep 27, 2015 6:49 pm
by Predz
Hey, maybe a odd request but how would I go about splitting a string in C++? I am sorta trying to recreate the following below in C++.

Syntax: Select all

def converter(steamid):
prefix, a, b = steamid.split(':')
return '[U:1:{}]'.format(int(b)*2+int(a))


Code: Select all

string ID2 = "STEAM_0:1:5110973";

Posted: Sun Sep 27, 2015 7:01 pm
by Predz
Dont worry fixed my own problem and just used string::substr :)

Posted: Tue Sep 29, 2015 9:05 pm
by Ayuto
Just wondering: why do you want to rewrite that in C++? For speed improvements? If yes, I'm interested to know in which situation you want to use it that performance matters.

Posted: Tue Sep 29, 2015 10:44 pm
by Predz
After the CSS update to Steam IDs, a lot of databases were unusable, so therefore I created a small executable file in which you supply a SQLite database path and it will automatically convert all Steam IDs to the new versions. The reason I needed to make a exe file was because I was creating this generally for server owners, whom have a lack of programming knowledge. So had to make it very basic, hehe :)

Posted: Wed Sep 30, 2015 8:07 am
by Predz
Also to elaborate on the purpose of speed. Most of the databases - that I will be fixing - will have lengths in the tens of thousands (possibly hundreds of thousands), so speed is sorta an issue in this circumstance.