Replace in a String that Contains Repeated Chars
*edit
i am making a costume plugin. some costumes has name suffix of "w" for women and "m" for men. to make it simple im trying to make a code that detects what character is choosed (w/m) then random costume will bound to that chara based on gender. because the costumes are so many, i'm facing this problem. the costume is named "y19s4coswolfw" for women. it has "y19s4coswolfm" counterpart for men. if men is choosen, costume should be "y19s4coswolfm" whereas for women it should be "y19s4coswolfw". im thinking to simply just rename the suffix, which is "w" to "m" for men. the code below. Code:
if(g_choosensex[id] == 1 /*men*/ && equal(szChoosenCos[strlen(szChoosenCos)-1], "w") /*if choosen cos is have "w" suffix*/)Code:
y19s4cosmolfwAlso i've tried : Code:
replace(sz, charsmax(sz), sz[strlen(sz)-1], "m")How can i solve this? |
Re: Replace in a String that Contains Repeated Chars
:roll:
Code:
sz[4] = 'm'; |
Re: Replace in a String that Contains Repeated Chars
Quote:
|
Re: Replace in a String that Contains Repeated Chars
Please better describe your problem. Do you want to replace all characters that presented in the string two or more times starting from second occurrence?
abcd[a]ef[b][a]g -> abcdefg Or specific character, or the last one? |
Re: Replace in a String that Contains Repeated Chars
Quote:
|
Re: Replace in a String that Contains Repeated Chars
Quote:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
Re: Replace in a String that Contains Repeated Chars
Quote:
also if i want to delete suffix with underscore symbol is it just change Quote:
PHP Code:
|
Re: Replace in a String that Contains Repeated Chars
replace is not you need according to its description.
"Given a string, replaces the first occurrence of a search string with a replacement string." "also if i want to delete suffix with underscore symbol is it just change to ...?" Yes, but when doing PHP Code:
|
Re: Replace in a String that Contains Repeated Chars
PHP Code:
|
Re: Replace in a String that Contains Repeated Chars
this is certainly not the best way to do it, you can simply make an array with each 'kit' and save it in some variable and then retrieve it with the correct position of the costumes.
like this -> https://bit.ly/3cuYCED |
| All times are GMT -4. The time now is 00:19. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.