Odd Request (Splitting string in C++)

General discussion for off-topic subjects.
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Odd Request (Splitting string in C++)

Postby Predz » Sun Sep 27, 2015 6:49 pm

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";
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Sun Sep 27, 2015 7:01 pm

Dont worry fixed my own problem and just used string::substr :)
User avatar
Ayuto
Project Leader
Posts: 2193
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Sep 29, 2015 9:05 pm

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.
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Tue Sep 29, 2015 10:44 pm

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 :)
Predz
Senior Member
Posts: 158
Joined: Wed Aug 08, 2012 9:05 pm
Location: Bristol, United Kingdom

Postby Predz » Wed Sep 30, 2015 8:07 am

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.

Return to “Whatever”

Who is online

Users browsing this forum: No registered users and 14 guests