Page 1 of 2

String Things - Stand-alone string manipulation functions

Posted: 01 Oct 2013, 09:19
by tidbit
String Things v2.6
A collection of commonly needed functions for working with strings and arrays.

There are better descriptions and an example for each function in the comments of the code.
Download

Code: Select all

No functions rely on eachother. You may simply copy/paste the ones you want or need.
.-==================================================================-.
|Function                                                            |
|====================================================================|
| st_count(string [, searchFor])                                     |
| st_insert(insert, into [, pos])                                    |
| st_delete(string [, start, length])                                |
| st_overwrite(overwrite, into [, pos])                              |
| st_format(string, param1, param2, param3, ...)                     |
| st_word(string [, wordNu, Delim, temp])                            |
| st_subString(string, searchFor [, direction, instance, searchFor2])|
| st_jumble(Text[, Weight, Delim , Omit])                            |
|                                                                    |
| st_lineWrap(string [, column, indent])                             |
| st_wordWrap(string [, column, indent])                             |
| st_readLine(string, line [, delim, exclude])                       |
| st_deleteLine(string, line [, delim, exclude])                     |
| st_insertLine(insert, into, line [, delim, exclude])               |
|                                                                    |
| st_flip(string)                                                    |
| st_setCase(string [, case])                                        |
| st_contains(mixed [, lookFor*])                                    |
| st_removeDuplicates(string [, delim])                              |
| st_pad(string [, left, right, LCount, RCount])                     |
|                                                                    |
| st_group(string, size, separator [, perLine, startFromFront])      |
| st_columnize(data [, delim, justify, pad, colsep])                 |
| st_center(text [, fill, symFIll, delim, exclude])                  |
| st_right(text [, fill, delim, exclude])                            |
|----------------------------------------------------------------    |
|array stuff:                                                        |
|   st_split(string [, delim, exclude])                              |
|   st_glue(array [, delim])                                         |
|   st_printArr(array [, depth])                                     |
|   st_countArr(array [, depth])                                     |
|   st_randomArr(array [, min, max, timeout])                        |
'-==================================================================-'
Log:
Spoiler

Re: String Things - Stand-alone string manipulation function

Posted: 27 Dec 2013, 15:29
by tidbit
added st_columnize(data [, delim, justify, pad, colsep]) Screenshot
afterlemon updated st_substring()

Re: String Things - Stand-alone string manipulation function

Posted: 28 Dec 2013, 11:43
by tidbit
2.4
added st_center()
added st_right()

They are simple justification functions, no fancy bells-and-whistles.

Re: String Things - Stand-alone string manipulation function

Posted: 02 Jan 2014, 12:57
by tidbit
2.5
Nameless-exe fixed, shorted and optimized st_jumble()!

Edit:
I just undid his changes. they were flawed :P instead I fixed a minor bug with the weight grouping.

Re: String Things - Stand-alone string manipulation function

Posted: 06 Mar 2014, 11:08
by joedf
nice-o!

Re: String Things - Stand-alone string manipulation function

Posted: 06 Mar 2014, 14:23
by Verdlin
Pretty much my favorite and most-used library.

Re: String Things - Stand-alone string manipulation function

Posted: 07 Mar 2014, 11:09
by tidbit
Thanks guys! :D

Re: String Things - Stand-alone string manipulation function

Posted: 07 Mar 2014, 18:34
by Guest10
download link NOT working... :cry:

Re: String Things - Stand-alone string manipulation function

Posted: 07 Mar 2014, 18:38
by joedf
Guest10 wrote:download link NOT working... :cry:
Right-click Link and Save as... ???

Re: String Things - Stand-alone string manipulation function

Posted: 08 Mar 2014, 10:34
by tidbit
Works for me. Even a normal click. Was probably just some downtime.

Re: String Things - Stand-alone string manipulation function

Posted: 08 Mar 2014, 14:10
by Guest10
it always says, "Problem loading page"
The connection has timed out

The server at tidbit.3owl.com is taking too long to respond.

The site could be temporarily unavailable or too busy. Try again in a few
moments.
If you are unable to load any pages, check your computer's network
connection.
If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.

Re: String Things - Stand-alone string manipulation function

Posted: 10 Mar 2014, 08:13
by ozzii
Working for me right now : 14:13 CET

Re: String Things - Stand-alone string manipulation function

Posted: 27 May 2014, 19:37
by Verdlin
I would find a st_Concat(delim, s*...) function quite useful.

Re: String Things - Stand-alone string manipulation function

Posted: 27 May 2014, 20:04
by joedf

Code: Select all

sprintf(msg, vargs*) {
    for each, varg in vargs
    StringReplace,msg,msg,`%s, % varg ;msg:=RegExReplace(msg,"i)`%.",varg)
    return msg
}

mystring := sprintf("Hello %s!","joedf")
? :D

Re: String Things - Stand-alone string manipulation function

Posted: 27 May 2014, 21:32
by Guest10
tried again to download. looks like i have to sign up. do i have to sign up to upload this script? :lol:

Re: String Things - Stand-alone string manipulation function

Posted: 28 May 2014, 04:42
by Verdlin
Thanks, Joe. It's actually slightly different than that.

Code: Select all

{
	Msgbox % st_Concat("|", 1, 2, 3, 4,5 ,6)
	return
}

st_Concat(delim, as*)
{
	for k, v in as
		s .= v . delim
	return s
}

Re: String Things - Stand-alone string manipulation function

Posted: 28 May 2014, 05:37
by joedf
Ahh ok :O :)

Re: String Things - Stand-alone string manipulation function

Posted: 28 May 2014, 09:32
by tidbit
joedf: sprintf already exists in ST :D st_format(). I think I went off the PHP name, can't remember.
Verdlin: Will add that!

There will be an update sooner or later. I've made some other minor changes aswell.

Re: String Things - Stand-alone string manipulation function

Posted: 28 May 2014, 11:28
by guest3456
Verdlin wrote:Thanks, Joe. It's actually slightly different than that.

Code: Select all

{
	Msgbox % st_Concat("|", 1, 2, 3, 4,5 ,6)
	return
}

st_Concat(delim, as*)
{
	for k, v in as
		s .= v . delim
	return s
}

using those braces for the auto-execute section is unnecessary

Re: String Things - Stand-alone string manipulation function

Posted: 28 May 2014, 11:47
by AfterLemon
Verdlin wrote:I would find a st_Concat(delim, s*...) function quite useful.
I'm not sure that's more than a few characters you might be saving. Obviously it could be done, but it's not even something that's easier done in a function than just with a single command.

Data:="a,b,c,d,e,f,g,h",Data:=ST_Concat("|",Data*)
vs
Data:="a,b,c,d,e,f,g,h"
StringReplace,Data,Data,`,,|,1