CabConModding
Facebook
Twitter
youtube
Discord
Contact us
RSS
Menu
CabConModding
Home
New
Top
Premium
Rules
FAQ - Frequently Asked Questions
Games
Fornite
Call of Duty: Black Ops 3
Clash of Clans
Grand Theft Auto 5
Apex Legends
Assassin’s Creed Origins
Forums
Premium
Latest posts
What's new
Latest posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Log in
Register
What's new
Premium
Latest posts
Menu
Log in
Register
Navigation
Install the app
Install
More options
Dark Theme
Contact us
Close Menu
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 2
Call of Duty: Black Ops 2 Mods and Scripts
Call of Duty: Black Ops 2 Scripts
Illegally useful string conversations :D
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="CF4_99" data-source="post: 62184" data-attributes="member: 201"><p>That method was actually created by extinct a long time ago. Only difference is the unnecessary utility functions that were added.</p><p></p><p>Here is my method of doing it. Which I personally find to be a lot better.</p><p></p><p></p><p>It does everything Extinct's method does, but it automatically replaces '_' with spaces. Along with a custom list of strings that will be removed from the final string output. It also capitalizes the first letter of the strings.</p><p></p><p>Just needs to be called like this: CleanString(<string>)</p><p>If the string contains spaces, and doesn't contain any underscores, it will just return the original string.</p><p></p><p>[CODE=cpp]CleanString(string)</p><p>{</p><p> if(string[0] == ToUpper(string[0]))</p><p> if(IsSubStr(string, " ") && !IsSubStr(string, "_"))</p><p> return string;</p><p> </p><p> string = StrTok(ToLower(string), "_");</p><p> str = "";</p><p> </p><p> for(a = 0; a < string.size; a++)</p><p> {</p><p> //List of strings/chars what will be removed from the final string output</p><p> strings = ["specialty", "zombie", "zm", "t7", "t6", "p7", "zmb", "zod", "ai", "g", "bg", "perk", "player", "weapon", "wpn", "aat", "bgb", "visionset", "equip", "craft", "der", "viewmodel", "mod", "fxanim", "moo", "moon", "zmhd", "fb", "bc", "asc", "vending"];</p><p> </p><p> //This will replace any '_' found in the string</p><p> replacement = " ";</p><p></p><p> if(!isInArray(strings, string[a]))</p><p> {</p><p> for(b = 0; b < string[a].size; b++)</p><p> if(b != 0)</p><p> str += string[a][b];</p><p> else</p><p> str += ToUpper(string[a][b]);</p><p> </p><p> if(a != (string.size - 1))</p><p> str += replacement;</p><p> }</p><p> }</p><p> </p><p> return str;</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="CF4_99, post: 62184, member: 201"] That method was actually created by extinct a long time ago. Only difference is the unnecessary utility functions that were added. Here is my method of doing it. Which I personally find to be a lot better. It does everything Extinct's method does, but it automatically replaces '_' with spaces. Along with a custom list of strings that will be removed from the final string output. It also capitalizes the first letter of the strings. Just needs to be called like this: CleanString(<string>) If the string contains spaces, and doesn't contain any underscores, it will just return the original string. [CODE=cpp]CleanString(string) { if(string[0] == ToUpper(string[0])) if(IsSubStr(string, " ") && !IsSubStr(string, "_")) return string; string = StrTok(ToLower(string), "_"); str = ""; for(a = 0; a < string.size; a++) { //List of strings/chars what will be removed from the final string output strings = ["specialty", "zombie", "zm", "t7", "t6", "p7", "zmb", "zod", "ai", "g", "bg", "perk", "player", "weapon", "wpn", "aat", "bgb", "visionset", "equip", "craft", "der", "viewmodel", "mod", "fxanim", "moo", "moon", "zmhd", "fb", "bc", "asc", "vending"]; //This will replace any '_' found in the string replacement = " "; if(!isInArray(strings, string[a])) { for(b = 0; b < string[a].size; b++) if(b != 0) str += string[a][b]; else str += ToUpper(string[a][b]); if(a != (string.size - 1)) str += replacement; } } return str; }[/CODE] [/QUOTE]
Verification
Post reply
Forums
Gaming
Call of Duty Classics
Call of Duty: Black Ops 2
Call of Duty: Black Ops 2 Mods and Scripts
Call of Duty: Black Ops 2 Scripts
Illegally useful string conversations :D
CabConModding is now on facebook! Check the latest Updates, the Site Status and much more now!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top