There's no practical use for the code that would be needed to do these things.
Therefor you should ask what you really need.
(Use formatex instead of format)
Code:
#include <amxmodx>
public plugin_init() {
register_plugin("Test Plugin 6", "", "");
new string[10] = "hello";
new string2[20];
for ( new i = 0 ; string[i] && i * 2 + 1 < charsmax(string2) ; i++ ) {
string2[i * 2] = '|';
string2[i * 2 + 1] = string[i];
}
string2[strlen(string2)] = '|';
server_print("string: %s^nstring2: %s", string, string2);
}
Code:
#include <amxmodx>
public plugin_init() {
register_plugin("Test Plugin 6", "", "");
new string[10] = "hello";
new string2[20];
for ( new i = 0, o = 0 ; string[i] && o + 1 < charsmax(string2) ; i++, o += 2 ) {
string2[o] = '|';
string2[o + 1] = string[i];
}
string2[strlen(string2)] = '|';
server_print("string: %s^nstring2: %s", string, string2);
}
Code:
string: hello
string2: |h|e|l|l|o|
Code:
#include <amxmodx>
public plugin_init() {
register_plugin("Test Plugin 6", "", "");
new string[20] = "hey how are you";
new string2[40] = "|";
for ( new i = 0, o = 1 ; string[i] && o + 1 < charsmax(string2) ; i++, o++ ) {
string2[o] = string[i];
if ( string[i] == ' ' )
string2[++o] = '|';
}
server_print("string: %s^nstring2: %s", string, string2);
}
Code:
string: hey how are you
string2: |hey |how |are |you
__________________