Skip to main content

Strings

Strings

In this section displays all of the string methods available in Jaseci for manipulating strings. These methods provide a comprehensive and efficient way to work with strings in your application.

upper

Op.str::upper
ArgsNone
DescriptionConvert the string into uppercase.

Example Usage

walker init{
_string = "Jaseci is an end-to-end open-source and Open Computational Model";
report _string.str::upper;
}

Expected Oputput

"report": [
"JASECI IS AN END-TO-END OPEN-SOURCE AND OPEN COMPUTATIONAL MODEL"
]

lower

Op.str::lower
ArgsNone
DescriptionConvert the string into lowercase.

Example Usage

walker init{
_string = "Jaseci is an end-to-end open-source and Open Computational Model";
report _string.str::lower;
}

Expected Oputput

"report": [
"jaseci is an end-to-end open-source and open computational model"
]

title

Op.str::title
ArgsNone
DescriptionConvert the string into camel case.

Example Usage

walker init{
_string = "jaseci is an end-to-end open-source and open computational model";
report _string.str::title;
}

Expected Oputput

"report": [
"Jaseci Is An End-To-End Open-Source And Open Computational Model"
]

capitalize

Op.str::capitalize
ArgsNone
DescriptionThe first letter of the string will be converted into Capital.

Example Usage

walker init{
_string = "jaseci is an end-to-end open-source and open computational model";
report _string.str::capitalize;
}

Expected Oputput

"report": [
"Jaseci is an end-to-end open-source and open computational model"
],

swap_case

Op.str::swap_case
ArgsNone
Description

Example Usage

walker init{
_string = "Jaseci is an End-to-End Open-Source and Open Computational Model";
report _string.str::swap_case;
}

Expected Oputput

  "report": [
"jASECI IS AN eND-TO-eND oPEN-sOURCE AND oPEN cOMPUTATIONAL mODEL"
],

is_alnum

Op.str::is_alnum
ArgsNone
DescriptionReturn true if the string is alpha numerical.

Example Usage

walker init{
_string = "123";
report _string.str::is_alnum;
}

Expected Oputput

 "report": [
true
],

is_digit

Op.str::is_digit
ArgsNone
DescriptionReturns true if string contains digits.

Example Usage

walker init{
_string = "123";
report _string.str::is_digit;
}

Expected Oputput

 "report": [
true
]

is_title

Op.str::is_title
ArgsNone
DescriptionReturn true if the first letter of the string is capital.

Example Usage

walker init{
_string = "Hello world";
report _string.str::is_title;
}

Expected Oputput

"report": [
true
]

is_upper

Op.str::is_upper
ArgsNone
DescriptionReturn true if all characters in the string is in Caps.

Example Usage

walker init{
_string = "HELLO WORLD";
report _string.str::is_upper;
}

Expected Oputput

"report": [
true
],

is_lower

Op.str::is_lower
ArgsNone
DescriptionReturn true if all characters in the string is in lower case.

Example Usage

walker init{
_string = "hello world";
report _string.str::is_lower;
}

Expected Oputput

"report": [
true
],

is_space

Op.str::is_space
ArgsNone
DescriptionReturn true if the string contains only white spaces.

Example Usage

walker init{
_string = " ";
report _string.str::is_space;
}

Expected Oputput

"report": [
true
]

load_json

Op.str::load_json
ArgsNone
Description

Example Usage


Expected Oputput


count

Op.str::count
Argssubstr, start, end
DescriptionReturns the number of occurrences of a sub-string in the given string. Start and end specify range of indices to search

Example Usage

walker init{
_string = "Hello World";
report _string.str::count("l",0,11);
}

Expected Oputput

 "report": [
3
]

find

Op.str::find
Argssubstr, start, end
DescriptionReturns the index of first occurrence of the substring (if found). If not found, it returns -1. Start and end specify range of indices to search.

Example Usage

walker init{
_string = "Hello World";
report _string.str::find("l");
}

Expected Oputput

"report": [
2
]

split

Op.str::split
Argsoptional (separator,maxsplit)
DescriptionBreaks up a string at the specified separator formaxsplit number of times and returns a list of strings. Default separators is ‘ ’ and maxsplit is unlimited.

Example Usage

walker init{
_string = "Hello World";
report _string.str::split("l");
}

Expected Oputput

"report": [
[
"He",
"",
"o Wor",
"d"
]
]

join

Op.str::join
Argsparams
DescriptionJoin elements of the sequence (params) separated by the string separator that calls the join function.

Example Usage

walker init{
_list = ["Hello", "World"];
report " ".str::join(_list);
}

Expected Oputput

"report": [
"Hello World"
]

statswith

Op.str::startswith
Argsparams
DescriptionReturn true if the string starts with the given substring.

Example Usage

walker init{
_string = "Hello World";
report _string.str::startswith("H");
}

Expected Oputput

"report": [
true
]

endswith

Op.str::endswith
Argsparams
DescriptionReturn true if the string ends with the given substring.

Example Usage

walker init{
_string = "Hello World";
report _string.str::endsswith("d");
}

Expected Oputput

"report": [
true
]

replace

Op.str::replace
Argsparams
DescriptionReplace the string with the given substring.

Example Usage

walker init{
_string = "Hello World";
report _string.str::replace("World", "Jaseci");
}

Expected Oputput

"report": [
"Hello Jaseci"
]

strip

Op.str::strip
Argsoptional
DescriptionRemoves any leading (spaces at the beginning) and trailing (spaces at the end) characters (space is the default leading character to remove).

Example Usage

walker init{
_string = " Hello World ";
report _string.str::strip;
}

Expected Oputput

"report": [
"Hello World"
]

lstrip

Op.str::lstrip
ArgsOptional
DescriptionRemoves any leading (spaces at the beginning) characters (space is the default leading character to remove).

Example Usage

walker init{
_string = " Hello World ";
report _string.str::lstrip;
}

Expected Oputput

"report": [
"Hello World "
]

rstrip

Op.str::rstrip
ArgsOptional
DescriptionRemoves trailing (spaces at the end) characters (space is the default leading character to remove).

Example Usage

walker init{
_string = " Hello World ";
report _string.str::rstrip;
}

Expected Oputput

"report": [
" Hello World"
]