strins native
#1

Why is the strins function in string.inc tagged as a Boolean when that function is supposed to return a string?

Код:
native bool: strins(string[], const substr[], pos, maxlength=sizeof string);
Reply
#2

Quote:
Originally Posted by <__Ǝthan__>
Why is the strins function in string.inc tagged as a Boolean when that function is supposed to return a string?

Код:
native bool: strins(string[], const substr[], pos, maxlength=sizeof string);
"string[]" is the base input & output string

Reply
#3

Well yes I already know that, that wasn't the question...
Reply
#4

Bill Gates told me: http://msdn.microsoft.com/en-us/library/aa892194.aspx
Reply
#5

By the location of the bool, I think its for the return. Such as; if it was successfully inserted, it returns true.
Reply
#6

strins - Insert a sub-string in a string

Syntax: bool: strins(string[], const substr[], index, maxlength=sizeof string)

string The source and destination string.
substr The string to insert in parameter string.
index The character position of string where substr is inserted. When 0, substr is prepended to string.
maxlength If the length of dest would exceed maxlength cells
after in

Returns: true on success and false on failure. - that's why it's boolean tag.

Notes: During insertion, the substr parameter may be converted from a packed string to an unpacked string, or vice versa, in order to match string. If the total length of string would exceed maxlength cells after inserting substr, the function raises an error.


This can be found at (PAWN) String_Manipulation.pdf file.
Reply
#7

Your Bill Gates strins is different from sa:mp's one. Same as most functions in the includes you get with the server
Reply
#8

Quote:
Originally Posted by Don Correlli
strins - Insert a sub-string in a string

Syntax: bool: strins(string[], const substr[], index, maxlength=sizeof string)

string The source and destination string.
substr The string to insert in parameter string.
index The character position of string where substr is inserted. When 0, substr is prepended to string.
maxlength If the length of dest would exceed maxlength cells
after in

Returns: true on success and false on failure. - that's why it's boolean tag.

Notes: During insertion, the substr parameter may be converted from a packed string to an unpacked string, or vice versa, in order to match string. If the total length of string would exceed maxlength cells after inserting substr, the function raises an error.


This can be found at (PAWN) String_Manipulation.pdf file.
Thanks Don, that's what I wanted to know
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)