[Snippet] Remove last character string

Joined
Dec 31, 2015
Messages
712
Reaction score
27
RE: [Snippet] Remove last string

mom im famous
That "snippet" removes last character in the string
 

Ninja FTW

Active member
Joined
Aug 11, 2017
Messages
61
Reaction score
0
Location
Saturn
RE: [Snippet] Remove last string

supahdupahnubah said:
mom im famous
That "snippet" removes last character in the string

Lol. That might come in handy for newbie. Actually i also wasn't know how to dot that.
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
RE: [Snippet] Remove last string

Ninja FTW said:
Lol. That might come in handy for newbie. Actually i also wasn't know how to dot that.

Nah, I mean, the title is misleading
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
100 % working without SAMPFUNCS
PHP:
:DeleteLastChars
{
    0AB1: @delete_last_chars_from_string 2 6@ 2
}
var
0@: int
1@: int
2@: int
end

0AB1: @strlen 1 string 0@ rtn 2@
2@ -= 1@
0@ += 2@
0AB1: @memset 3 destination 0@ value 0 size 1@
0AB2: ret 0

:strlen
{
    Example: 0AB1: @strlen 1 string 1@ return: 3@
    In: 0@ - text;
    Out: 1@ - size;
}

for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@

:memset

var
0@ : integer
1@ : integer
2@ : integer
3@ : integer
end

// 0@ - destination, 1@ - value, 2@ - size
// Example: 0AB1: @memset 3 destination 0@ value 32 size 1
2@ -= 1
for 3@ = 0 to 2@
0A8C: write_memory 0@ size 1 value 1@ virtual_protect 0
0@ += 1
end

0AB2: ret 0
 
Last edited:

SamThapa

Active member
Joined
Jan 22, 2018
Messages
82
Reaction score
2
i need script

"abcdefg hijklmn"

divided by space

i need "abcdefg" return as 0@ "hijklmn" as 1@ is it possible ?
 
Top