ajstr.c
Datatypes: char* AjPStr const AjPStr AjIStr AjPStrTok
C character string
Sections: constructors destructors formatting comparison comparison (sorting) parsing functions
Functions for constructing C-type (char*) strings,
possibly with a starting string.
Functions: ajCharNewC ajCharNewS ajCharNewRes ajCharNewResC ajCharNewResS ajCharNewResLenC ajCharNull
A text string constructor which allocates memory for a string
and initialises it with the text string provided.
Synopsis
Prototype
char* ajCharNewC (
const char* txt
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Initial text, possibly shorter than the
space allocated. |
char* | | RETURN | A new text string. |
Input
txt: | (Input) | Initial text, possibly shorter than the
space allocated. |
Returns
Description
A text string constructor which allocates memory for a string
and initialises it with the text string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
A text string constructor which allocates memory for a string
and initialises it with the string provided.
Synopsis
Prototype
char* ajCharNewS (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String object as initial value and size
for the text. |
char* | | RETURN | A new text string. |
Input
str: | (Input) | String object as initial value and size
for the text. |
Returns
Description
A text string constructor which allocates memory for a string
and initialises it with the string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
A text string constructor which allocates memory for a string of the
specified length and initialises the contents as an empty string.
Synopsis
Prototype
char* ajCharNewRes (
size_t size
);
Type | Name | Read/Write | Description |
size_t | size | Input | Length of the Cstring, excluding the trailing NULL. |
char* | | RETURN | A new text string with no contents. |
Input
size: | (Input) | Length of the Cstring, excluding the trailing NULL. |
Returns
char*: | A new text string with no contents. |
Description
A text string constructor which allocates memory for a string of the
specified length and initialises the contents as an empty string.
See Also
See other functions in this section
Availability
In release 6.4.0
A text string constructor which allocates memory for a string of the
specified length and initialises it with the text string provided.
Synopsis
Prototype
char* ajCharNewResC (
const char* txt,
size_t size
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String object as initial value and size
for the text. |
size_t | size | Input | Maximum string length, as returned by strlen |
char* | | RETURN | A new text string. |
Input
txt: | (Input) | String object as initial value and size
for the text. |
size: | (Input) | Maximum string length, as returned by strlen |
Returns
Description
A text string constructor which allocates memory for a string of the
specified length and initialises it with the text string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
A text string constructor which allocates memory for a string of the
specified length and initialises it with the string provided.
Synopsis
Prototype
char* ajCharNewResS (
const AjPStr str,
size_t size
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String object as initial value and size
for the text. |
size_t | size | Input | Maximum string length, as returned by strlen |
char* | | RETURN | A new text string. |
Input
str: | (Input) | String object as initial value and size
for the text. |
size: | (Input) | Maximum string length, as returned by strlen |
Returns
Description
A text string constructor which allocates memory for a string of the
specified length and initialises it with the string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
A text string constructor which allocates memory for a string of the
specified length and initialises it with the text string provided.
Synopsis
Prototype
char* ajCharNewResLenC (
const char* txt,
size_t size,
size_t len
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String object as initial value and size
for the text. |
size_t | size | Input | Maximum string length, as returned by strlen |
size_t | len | Input | Length of txt to save calculation time. |
char* | | RETURN | A new text string. |
Input
txt: | (Input) | String object as initial value and size
for the text. |
size: | (Input) | Maximum string length, as returned by strlen |
len: | (Input) | Length of txt to save calculation time. |
Returns
Description
A text string constructor which allocates memory for a string of the
specified length and initialises it with the text string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns a pointer to an empty string
Synopsis
Prototype
char* ajCharNull (
void
);
Type | Name | Read/Write | Description |
char* | | RETURN | Empty string |
Returns
Description
Returns a pointer to an empty string
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for destruction of C-type (char*) strings.
Functions: ajCharDel
A text string destructor to free memory for a text string.
Synopsis
Prototype
void ajCharDel (
char** Ptxt
);
Type | Name | Read/Write | Description |
char** | Ptxt | Delete | Text string to be deallocated. |
void | | RETURN | |
Output
Ptxt: | (Delete) | Text string to be deallocated. |
Returns
Description
A text string destructor to free memory for a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for formatting C-type (char*) strings).
Functions: ajCharFmtLower ajCharFmtUpper
Converts a text string to lower case.
Synopsis
Prototype
AjBool ajCharFmtLower (
char* txt
);
Type | Name | Read/Write | Description |
char* | txt | Modify | Text string |
AjBool | | RETURN | ajTrue on success |
Input & Output
Returns
Description
Converts a text string to lower case.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a text string to upper case.
Synopsis
Prototype
AjBool ajCharFmtUpper (
char* txt
);
Type | Name | Read/Write | Description |
char* | txt | Modify | Text string |
AjBool | | RETURN | ajTrue on success |
Input & Output
Returns
Description
Converts a text string to upper case.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for comparing C-type (char*) strings.
Functions: ajCharMatchC ajCharMatchCaseC ajCharMatchWildC ajCharMatchWildS ajCharMatchWildCaseC ajCharMatchWildCaseS ajCharMatchWildNextC ajCharMatchWildNextCaseC ajCharMatchWildWordC ajCharMatchWildWordCaseC ajCharPrefixC ajCharPrefixS ajCharPrefixCaseC ajCharPrefixCaseS ajCharSuffixC ajCharSuffixS ajCharSuffixCaseC ajCharSuffixCaseS
Simple test for matching two text strings.
Synopsis
Prototype
AjBool ajCharMatchC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if text completely matches the start of String |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
AjBool: | ajTrue if text completely matches the start of String |
Description
Simple test for matching two text strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching two text strings.
Synopsis
Prototype
AjBool ajCharMatchCaseC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if two strings are exactly the same excluding case |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
AjBool: | ajTrue if two strings are exactly the same excluding case |
Description
Simple case-insensitive test for matching two text strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-sensitive test for matching two text strings using
wildcard characters.
Synopsis
Prototype
AjBool ajCharMatchWildC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if the strings match |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
AjBool: | ajTrue if the strings match |
Description
Simple case-sensitive test for matching two text strings using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-sensitive test for matching a text string and a string using
wildcard characters.
Synopsis
Prototype
AjBool ajCharMatchWildS (
const char* txt,
const AjPStr str
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const AjPStr | str | Input | Wildcard text |
AjBool | | RETURN | ajTrue if the strings match |
Input
txt: | (Input) | String |
str: | (Input) | Wildcard text |
Returns
AjBool: | ajTrue if the strings match |
Description
Simple case-sensitive test for matching a text string and a string using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching two text strings using
wildcard characters.
Synopsis
Prototype
AjBool ajCharMatchWildCaseC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if the strings match |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
AjBool: | ajTrue if the strings match |
Description
Simple case-insensitive test for matching two text strings using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching a text string and a string using
wildcard characters.
Synopsis
Prototype
AjBool ajCharMatchWildCaseS (
const char* txt,
const AjPStr str
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const AjPStr | str | Input | Wildcard text |
AjBool | | RETURN | ajTrue if the strings match |
Input
txt: | (Input) | String |
str: | (Input) | Wildcard text |
Returns
AjBool: | ajTrue if the strings match |
Description
Simple case-insensitive test for matching a text string and a string using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the next 'word' in two text strings using
wildcard characters.
Synopsis
Prototype
AjBool ajCharMatchWildNextC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
Description
Test for matching the next 'word' in two text strings using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the next 'word' in two text strings using
wildcard characters, case-insensitive.
Synopsis
Prototype
AjBool ajCharMatchWildNextCaseC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
Description
Test for matching the next 'word' in two text strings using
wildcard characters, case-insensitive.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-sensitive test for matching a text string 'word' against any
word in a test text string using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
Synopsis
Prototype
AjBool ajCharMatchWildWordC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Wildcard word |
AjBool | | RETURN | ajTrue if found |
Input
txt: | (Input) | String |
txt2: | (Input) | Wildcard word |
Returns
Description
Case-sensitive test for matching a text string 'word' against any
word in a test text string using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching a text string 'word' against any
word in a text string using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
Synopsis
Prototype
AjBool ajCharMatchWildWordCaseC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Wildcard word |
AjBool | | RETURN | ajTrue if found |
Input
txt: | (Input) | String |
txt2: | (Input) | Wildcard word |
Returns
Description
Case-insensitive test for matching a text string 'word' against any
word in a text string using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the start of a text string against a given prefix text
string.
Synopsis
Prototype
AjBool ajCharPrefixC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Test string as text |
const char* | txt2 | Input | Prefix as text |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
txt: | (Input) | Test string as text |
txt2: | (Input) | Prefix as text |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Test for matching the start of a text string against a given prefix text
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the start of a text string against a given prefix string.
Synopsis
Prototype
AjBool ajCharPrefixS (
const char* txt,
const AjPStr str
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Test string as text |
const AjPStr | str | Input | Prefix as string |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
txt: | (Input) | Test string as text |
str: | (Input) | Prefix as string |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Test for matching the start of a text string against a given prefix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the start of a text string against a
given prefix text string.
Synopsis
Prototype
AjBool ajCharPrefixCaseC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Text |
const char* | txt2 | Input | Prefix |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
txt: | (Input) | Text |
txt2: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Case-insensitive test for matching the start of a text string against a
given prefix text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching start of a text string against a given
prefix string,
Synopsis
Prototype
AjBool ajCharPrefixCaseS (
const char* txt,
const AjPStr str
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Text |
const AjPStr | str | Input | Prefix |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
txt: | (Input) | Text |
str: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Case-insensitive test for matching start of a text string against a given
prefix string,
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the end of a text string against a given suffix text
string.
Synopsis
Prototype
AjBool ajCharSuffixC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Suffix as text |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
txt: | (Input) | String |
txt2: | (Input) | Suffix as text |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Test for matching the end of a text string against a given suffix text
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the end of a text string against a given suffix string.
Synopsis
Prototype
AjBool ajCharSuffixS (
const char* txt,
const AjPStr str
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Test string as text |
const AjPStr | str | Input | Suffix as string |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
txt: | (Input) | Test string as text |
str: | (Input) | Suffix as string |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Test for matching the end of a text string against a given suffix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the end of a text string against a given
suffix text string.
Synopsis
Prototype
AjBool ajCharSuffixCaseC (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Suffix as text |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
txt: | (Input) | String |
txt2: | (Input) | Suffix as text |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Case-insensitive test for matching the end of a text string against a given
suffix text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the end of a text string against a given
suffix string.
Synopsis
Prototype
AjBool ajCharSuffixCaseS (
const char* txt,
const AjPStr str
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Test string as text |
const AjPStr | str | Input | Suffix as string |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
txt: | (Input) | Test string as text |
str: | (Input) | Suffix as string |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Case-insensitive test for matching the end of a text string against a given
suffix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for sorting strings (including C-type char* strings).
Functions: ajCharCmpCase ajCharCmpCaseLen ajCharCmpWild ajCharCmpWildCase
Finds the sort order of two text strings.
Synopsis
Prototype
int ajCharCmpCase (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Text string |
const char* | txt2 | Input | Text string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
txt: | (Input) | Text string |
txt2: | (Input) | Text string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of two text strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of substrings from the start of two text strings.
Synopsis
Prototype
int ajCharCmpCaseLen (
const char* txt,
const char* txt2,
size_t len
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Text string |
const char* | txt2 | Input | Text string |
size_t | len | Input | length |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
txt: | (Input) | Text string |
txt2: | (Input) | Text string |
len: | (Input) | length |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of substrings from the start of two text strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort-order (case insensitive) of two text strings using
wildcard characters.
Synopsis
Prototype
int ajCharCmpWild (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort-order (case insensitive) of two text strings using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort-order (case sensitive) of two text strings using
wildcard characters.
Synopsis
Prototype
int ajCharCmpWildCase (
const char* txt,
const char* txt2
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String |
const char* | txt2 | Input | Text |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
txt: | (Input) | String |
txt2: | (Input) | Text |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort-order (case sensitive) of two text strings using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple token parsing of strings
Functions: ajCharParseC
Simple token parsing from text string using a specified set of delimiters.
Synopsis
Prototype
AjPStr ajCharParseC (
const char* txt,
const char* txtdelim
);
Type | Name | Read/Write | Description |
const char* | txt | Input | String to be parsed (first call) or
NULL for follow-up calls using the same string, as for the
C RTL function strtok which is eventually called. |
const char* | txtdelim | Input | Delimiter(s) to be used between tokens. |
AjPStr | | RETURN | Token |
Input
txt: | (Input) | String to be parsed (first call) or
NULL for follow-up calls using the same string, as for the
C RTL function strtok which is eventually called. |
txtdelim: | (Input) | Delimiter(s) to be used between tokens. |
Returns
Description
Simple token parsing from text string using a specified set of delimiters.
See Also
See other functions in this section
Availability
In release 6.4.0
String
Sections: constructors destructors assignment combination functions cutting substitution query element retrieval modifiable string retrieval element assignment string to datatype conversion functions datatype to string conversion functions formatting comparison comparison (sorting) comparison (search) functions parsing functions debugging exit
Functions for constructing string objects, possibly with a starting string.
Functions: ajStrNew ajStrNewC ajStrNewK ajStrNewS ajStrNewRef ajStrNewRes ajStrNewResC ajStrNewResS ajStrNewResLenC
Default string constructor which allocates memory for a string.
The null string usage pointer is incremented.
Synopsis
Prototype
AjPStr ajStrNew (
void
);
Type | Name | Read/Write | Description |
AjPStr | | RETURN | Pointer to an empty string |
Returns
AjPStr: | Pointer to an empty string |
Description
Default string constructor which allocates memory for a string.
The null string usage pointer is incremented.
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string and initialises it
with the text string provided.
The string size is set just large enough to hold the supplied text.
Synopsis
Prototype
AjPStr ajStrNewC (
const char* txt
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Null-terminated character string to initialise
the new string. |
AjPStr | | RETURN | Pointer to a string containing the supplied text |
Input
txt: | (Input) | Null-terminated character string to initialise
the new string. |
Returns
AjPStr: | Pointer to a string containing the supplied text |
Description
String constructor which allocates memory for a string and initialises it
with the text string provided.
The string size is set just large enough to hold the supplied text.
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string and initialises it
with the single character provided.
The string size is set just large enough to hold the supplied text.
Synopsis
Prototype
AjPStr ajStrNewK (
char ch
);
Type | Name | Read/Write | Description |
char | ch | Input | Null-terminated character string to initialise
the new string. |
AjPStr | | RETURN | Pointer to a string containing the supplied text |
Input
ch: | (Input) | Null-terminated character string to initialise
the new string. |
Returns
AjPStr: | Pointer to a string containing the supplied text |
Description
String constructor which allocates memory for a string and initialises it
with the single character provided.
The string size is set just large enough to hold the supplied text.
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string and initialises it
with the string provided.
Synopsis
Prototype
AjPStr ajStrNewS (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to be cloned |
AjPStr | | RETURN | Pointer to a string of the specified size
containing the supplied text. |
Input
str: | (Input) | String to be cloned |
Returns
AjPStr: | Pointer to a string of the specified size
containing the supplied text. |
Description
String constructor which allocates memory for a string and initialises it
with the string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
String referencing function which returns a pointer to the string passed in
and increases its reference count.
Not a true string copy, but if modified the new string will behave
as a copy.
Synopsis
Prototype
AjPStr ajStrNewRef (
AjPStr refstr
);
Type | Name | Read/Write | Description |
AjPStr | refstr | Modify | AJAX string object |
AjPStr | | RETURN | Pointer to the string passed as an argument,
with its use count increased by 1. |
Input & Output
refstr: | (Modify) | AJAX string object |
Returns
AjPStr: | Pointer to the string passed as an argument,
with its use count increased by 1. |
Description
String referencing function which returns a pointer to the string passed in
and increases its reference count.
Not a true string copy, but if modified the new string will behave
as a copy.
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string of an initial
reserved size (including a possible null).
Synopsis
Prototype
AjPStr ajStrNewRes (
size_t size
);
Type | Name | Read/Write | Description |
size_t | size | Input | Reserved size (including a possible null). |
AjPStr | | RETURN | Pointer to an empty string of specified size. |
Input
size: | (Input) | Reserved size (including a possible null). |
Returns
AjPStr: | Pointer to an empty string of specified size. |
Description
String constructor which allocates memory for a string of an initial
reserved size (including a possible null).
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string of an initial
reserved size (including a possible null) and initialises it with the text
string provided.
Synopsis
Prototype
AjPStr ajStrNewResC (
const char* txt,
size_t size
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Null-terminated character string to initialise
the new string. |
size_t | size | Input | Reserved size (including a possible null). |
AjPStr | | RETURN | Pointer to a string of the specified size
containing the supplied text. |
Input
txt: | (Input) | Null-terminated character string to initialise
the new string. |
size: | (Input) | Reserved size (including a possible null). |
Returns
AjPStr: | Pointer to a string of the specified size
containing the supplied text. |
Description
String constructor which allocates memory for a string of an initial
reserved size (including a possible null) and initialises it with the text
string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string of an initial
reserved size (including a possible null) and initialises it with the string
provided.
Synopsis
Prototype
AjPStr ajStrNewResS (
const AjPStr str,
size_t size
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to initialise
the new string. |
size_t | size | Input | Reserved size (including a possible null). |
AjPStr | | RETURN | Pointer to a string of the specified size
containing the supplied text. |
Input
str: | (Input) | String to initialise
the new string. |
size: | (Input) | Reserved size (including a possible null). |
Returns
AjPStr: | Pointer to a string of the specified size
containing the supplied text. |
Description
String constructor which allocates memory for a string of an initial
reserved size (including a possible null) and initialises it with the string
provided.
See Also
See other functions in this section
Availability
In release 6.4.0
String constructor which allocates memory for a string of a given length
and of an initial reserved size (including a possible null) and initialises
it with the text string provided.
Synopsis
Prototype
AjPStr ajStrNewResLenC (
const char* txt,
size_t size,
size_t len
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Null-terminated character string to initialise
the new string. |
size_t | size | Input | Reserved size, including a trailing null and
possible space for expansion |
size_t | len | Input | Length of txt to save calculation time. |
AjPStr | | RETURN | Pointer to a string of the specified size
containing the supplied text. |
Input
txt: | (Input) | Null-terminated character string to initialise
the new string. |
size: | (Input) | Reserved size, including a trailing null and
possible space for expansion |
len: | (Input) | Length of txt to save calculation time. |
Returns
AjPStr: | Pointer to a string of the specified size
containing the supplied text. |
Description
String constructor which allocates memory for a string of a given length
and of an initial reserved size (including a possible null) and initialises
it with the text string provided.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for destruction of string objects.
Functions: MAJSTRDEL ajStrDel ajStrDelStatic ajStrDelarray
Default string destructor which frees memory for a string.
Decrements the use count. When it reaches zero, the string is removed from
memory. If the given string is NULL, or a NULL pointer, simply returns.
A macro version of {ajStrDel} available in case it is needed for speed.
Output
Pstr: | (Delete) | Pointer to the string to be deleted.
The pointer is always deleted. |
Returns
Description
Default string destructor which frees memory for a string.
Decrements the use count. When it reaches zero, the string is removed from
memory. If the given string is NULL, or a NULL pointer, simply returns.
A macro version of {ajStrDel} available in case it is needed for speed.
See Also
See other functions in this section
Availability
In release 6.4.0
Default string destructor which frees memory for a string.
Decrements the use count. When it reaches zero, the string is removed from
memory. If the given string is NULL, or a NULL pointer, simply returns.
Synopsis
Prototype
void ajStrDel (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Delete | Pointer to the string to be deleted.
The pointer is always deleted. |
void | | RETURN | |
Output
Pstr: | (Delete) | Pointer to the string to be deleted.
The pointer is always deleted. |
Returns
Description
Default string destructor which frees memory for a string.
Decrements the use count. When it reaches zero, the string is removed from
memory. If the given string is NULL, or a NULL pointer, simply returns.
See Also
See other functions in this section
Availability
In release 6.4.0
String dereferencing function which sets a string pointer to NULL and
decrements the use count of the string to which it referred. Strings with a
use count of 1 are *not* freed to avoid freeing and reallocating memory when
they are reused.
Memory reserved for the string is never deleted and can always be
reused by any remaining AjPStr that points to it even if this pointer
is cleared.
Use for more efficient memory management for static strings, to avoid
reallocation when used in a subsequent call.
If the given string is NULL, or a NULL pointer, simply returns.
Synopsis
Prototype
AjBool ajStrDelStatic (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Pointer to the string to be deleted. |
AjBool | | RETURN | True if the string exists and can be reused
False if the string was deleted. |
Output
Pstr: | (Output) | Pointer to the string to be deleted. |
Returns
AjBool: | True if the string exists and can be reused
False if the string was deleted. |
Description
String dereferencing function which sets a string pointer to NULL and
decrements the use count of the string to which it referred. Strings with a
use count of 1 are *not* freed to avoid freeing and reallocating memory when
they are reused.
Memory reserved for the string is never deleted and can always be
reused by any remaining AjPStr that points to it even if this pointer
is cleared.
Use for more efficient memory management for static strings, to avoid
reallocation when used in a subsequent call.
If the given string is NULL, or a NULL pointer, simply returns.
See Also
See other functions in this section
Availability
In release 6.4.0
Default string destructor which frees memory for an array of strings.
Decrements the use count. When it reaches zero, the string is removed from
memory. If the given string is NULL, or a NULL pointer, simply returns.
Synopsis
Prototype
void ajStrDelarray (
AjPStr** PPstr
);
Type | Name | Read/Write | Description |
AjPStr** | PPstr | Delete | Pointer to the string array to be deleted.
The last string is a NULL pointer
The pointer is always deleted. |
void | | RETURN | |
Output
PPstr: | (Delete) | Pointer to the string array to be deleted.
The last string is a NULL pointer
The pointer is always deleted. |
Returns
Description
Default string destructor which frees memory for an array of strings.
Decrements the use count. When it reaches zero, the string is removed from
memory. If the given string is NULL, or a NULL pointer, simply returns.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for assigning a string.
Functions: ajStrAssignC ajStrAssignK ajStrAssignS ajStrAssignClear ajStrAssignEmptyC ajStrAssignEmptyS ajStrAssignLenC ajStrAssignRef ajStrAssignResC ajStrAssignResS ajStrAssignSubC ajStrAssignSubS
Copy a text string to a string.
Synopsis
Prototype
AjBool ajStrAssignC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
const char* | txt | Input | Source text. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copy a text string to a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a single character to a string.
Synopsis
Prototype
AjBool ajStrAssignK (
AjPStr* Pstr,
char chr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
char | chr | Input | Source text. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copy a single character to a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a string to a string.
This is a genuine copy (reference count isn't used). Useful where both
strings will be separately overwritten later so that they can both remain
modifiable.
Synopsis
Prototype
AjBool ajStrAssignS (
AjPStr* Pstr,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
const AjPStr | str | Input | Source string. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | Source string. |
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copy a string to a string.
This is a genuine copy (reference count isn't used). Useful where both
strings will be separately overwritten later so that they can both remain
modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Clear the string value
Synopsis
Prototype
AjBool ajStrAssignClear (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
AjBool | | RETURN | ajTrue if string was reallocated |
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Clear the string value
See Also
See other functions in this section
Availability
In release 6.4.0
Ensures a string is set (has a value). If the string is set it is left
alone, otherwise it is initialised with a text string.
Synopsis
Prototype
AjBool ajStrAssignEmptyC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string which is overwritten. |
const char* | txt | Input | Source text. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string which is overwritten. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Ensures a string is set (has a value). If the string is set it is left
alone, otherwise it is initialised with a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Ensures a string is set (has a value). If the string is set it is left
alone, otherwise it is initialised with a string.
Synopsis
Prototype
AjBool ajStrAssignEmptyS (
AjPStr* Pstr,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string which is overwritten. |
const AjPStr | str | Input | Source string object. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | Source string object. |
Output
Pstr: | (Output) | Target string which is overwritten. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Ensures a string is set (has a value). If the string is set it is left
alone, otherwise it is initialised with a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a text string of a given length to a string.
Synopsis
Prototype
AjBool ajStrAssignLenC (
AjPStr* Pstr,
const char* txt,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
const char* | txt | Input | Source text. |
size_t | len | Input | Length of source text. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Source text. |
len: | (Input) | Length of source text. |
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copy a text string of a given length to a string.
See Also
See other functions in this section
Availability
In release 6.4.0
String referencing function which makes a string point to another.
Increases the reference count of the string pointed to.
Not a true string copy, but if modified the new string will behave
as a copy.
Sets the destination string to NULL if the source string is NULL.
Synopsis
Prototype
AjBool ajStrAssignRef (
AjPStr* Pstr,
AjPStr refstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string which is overwritten. |
AjPStr | refstr | Modify | Source string object
Copy by reference count so not const. |
AjBool | | RETURN | ajTrue if string was reallocated |
Output
Pstr: | (Output) | Target string which is overwritten. |
Input & Output
refstr: | (Modify) | Source string object
Copy by reference count so not const. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
String referencing function which makes a string point to another.
Increases the reference count of the string pointed to.
Not a true string copy, but if modified the new string will behave
as a copy.
Sets the destination string to NULL if the source string is NULL.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a text string to a string with a minimum reserved size.
Synopsis
Prototype
AjBool ajStrAssignResC (
AjPStr* Pstr,
size_t size,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
size_t | size | Input | Space to reserve. |
const char* | txt | Input | Source text. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
size: | (Input) | Space to reserve. |
txt: | (Input) | Source text. |
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copy a text string to a string with a minimum reserved size.
See Also
See other functions in this section
Availability
In release 6.4.0
Copy a string to a string with a minimum reserved size.
Synopsis
Prototype
AjBool ajStrAssignResS (
AjPStr* Pstr,
size_t size,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
size_t | size | Input | Size of new string. |
const AjPStr | str | Input | Source text. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
size: | (Input) | Size of new string. |
str: | (Input) | Source text. |
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copy a string to a string with a minimum reserved size.
See Also
See other functions in this section
Availability
In release 6.4.0
Copies a substring of a text string to a string.
Synopsis
Prototype
AjBool ajStrAssignSubC (
AjPStr* Pstr,
const char* txt,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const char* | txt | Input | Source text |
ajlong | pos1 | Input | start position for substring |
ajlong | pos2 | Input | end position for substring |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Source text |
pos1: | (Input) | start position for substring |
pos2: | (Input) | end position for substring |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Copies a substring of a text string to a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Copies a substring of a string to a string.
Synopsis
Prototype
AjBool ajStrAssignSubS (
AjPStr* Pstr,
const AjPStr str,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string
|
const AjPStr | str | Input | Source string |
ajlong | pos1 | Input | Start position in src of substring
|
ajlong | pos2 | Input | End position in src of substring
|
AjBool | | RETURN | ajTrue if Pstr was (re)allocated, ajFalse otherwise |
Input
str: | (Input) | Source string |
pos1: | (Input) | Start position in src of substring
|
pos2: | (Input) | End position in src of substring
|
Output
Pstr: | (Output) | Target string
|
Returns
AjBool: | ajTrue if Pstr was (re)allocated, ajFalse otherwise |
Description
Copies a substring of a string to a string.
The substring is defined from character positions pos1 to pos2.
ajTrue is returned if target was
(re)allocated, ajFalse is returned otherwise.
Usage
Pstr: memory will be automatically allocated if required
pos1: negative values count from the end of the string
with -1 as the last position
pos2: negative values count from the end of the string
with -1 as the last position
See Also
See other functions in this section
Availability
EMBOSS 1.0.0
Functions for appending, inserting or overwriting a string
or substring to another.
Functions: ajStrAppendC ajStrAppendK ajStrAppendS ajStrAppendCountK ajStrAppendLenC ajStrAppendSubC ajStrAppendSubS ajStrInsertC ajStrInsertK ajStrInsertS ajStrJoinC ajStrJoinS ajStrMaskIdent ajStrMaskRange ajStrPasteS ajStrPasteCountK ajStrPasteMaxC ajStrPasteMaxS
Appends a text string to the end of a string.
Uses {ajStrSetRes} to make sure target string is modifiable.
Synopsis
Prototype
AjBool ajStrAppendC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const char* | txt | Input | Source text |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends a text string to the end of a string.
Uses {ajStrSetRes} to make sure target string is modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends a character to the end of a string.
Uses {ajStrSetRes} to make sure target string is modifiable.
Synopsis
Prototype
AjBool ajStrAppendK (
AjPStr* Pstr,
char chr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
char | chr | Input | Source character |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
chr: | (Input) | Source character |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends a character to the end of a string.
Uses {ajStrSetRes} to make sure target string is modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends a string to the end of another string.
Uses {ajStrSetRes} to make sure target string is modifiable.
Synopsis
Prototype
AjBool ajStrAppendS (
AjPStr* Pstr,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const AjPStr | str | Input | Source string |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends a string to the end of another string.
Uses {ajStrSetRes} to make sure target string is modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends any number of a given character to the end of a string.
Equivalent to a repeat count for ajStrAppK.
Uses {ajStrSetRes} to make sure target string is modifiable.
Synopsis
Prototype
AjBool ajStrAppendCountK (
AjPStr* Pstr,
char chr,
ajulong num
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
char | chr | Input | Source character |
ajulong | num | Input | Repeat count |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
chr: | (Input) | Source character |
num: | (Input) | Repeat count |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends any number of a given character to the end of a string.
Equivalent to a repeat count for ajStrAppK.
Uses {ajStrSetRes} to make sure target string is modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends a text string of a given length to the end of a string.
Uses {ajStrSetRes} to make sure target string is modifiable.
Synopsis
Prototype
AjBool ajStrAppendLenC (
AjPStr* Pstr,
const char* txt,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const char* | txt | Input | Source text |
size_t | len | Input | String length |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Source text |
len: | (Input) | String length |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends a text string of a given length to the end of a string.
Uses {ajStrSetRes} to make sure target string is modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends a substring of a string to the end of another string.
Synopsis
Prototype
AjBool ajStrAppendSubC (
AjPStr* Pstr,
const char* txt,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const char* | txt | Input | Source string |
ajlong | pos1 | Input | start position for substring |
ajlong | pos2 | Input | end position for substring |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Source string |
pos1: | (Input) | start position for substring |
pos2: | (Input) | end position for substring |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends a substring of a string to the end of another string.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends a substring of a string to the end of another string.
Uses {ajStrSetRes} to make sure target string is modifiable.
Synopsis
Prototype
AjBool ajStrAppendSubS (
AjPStr* Pstr,
const AjPStr str,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const AjPStr | str | Input | Source string |
ajlong | pos1 | Input | start position for substring |
ajlong | pos2 | Input | end position for substring |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | Source string |
pos1: | (Input) | start position for substring |
pos2: | (Input) | end position for substring |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Appends a substring of a string to the end of another string.
Uses {ajStrSetRes} to make sure target string is modifiable.
See Also
See other functions in this section
Availability
In release 6.4.0
Insert a text string into a string at a specified position.
Synopsis
Prototype
AjBool ajStrInsertC (
AjPStr* Pstr,
ajlong pos,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | Position where text is to be inserted.
Negative position counts from the end |
const char* | txt | Input | Text to be inserted |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
pos: | (Input) | Position where text is to be inserted.
Negative position counts from the end |
txt: | (Input) | Text to be inserted |
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Insert a text string into a string at a specified position.
See Also
See other functions in this section
Availability
In release 6.4.0
Inserts a character into a string at a specified position.
Synopsis
Prototype
AjBool ajStrInsertK (
AjPStr* Pstr,
ajlong pos,
char chr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | Position where text is to be inserted.
Negative position counts from the end |
char | chr | Input | Text to be inserted |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
pos: | (Input) | Position where text is to be inserted.
Negative position counts from the end |
chr: | (Input) | Text to be inserted |
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Inserts a character into a string at a specified position.
See Also
See other functions in this section
Availability
In release 6.4.0
Inserts a text string into a string at a specified position.
Synopsis
Prototype
AjBool ajStrInsertS (
AjPStr* Pstr,
ajlong pos,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | Position where text is to be inserted.
Negative position counts from the end |
const AjPStr | str | Input | String to be inserted |
AjBool | | RETURN | ajTrue on successful completion else ajFalse; |
Input
pos: | (Input) | Position where text is to be inserted.
Negative position counts from the end |
str: | (Input) | String to be inserted |
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue on successful completion else ajFalse; |
Description
Inserts a text string into a string at a specified position.
See Also
See other functions in this section
Availability
In release 6.4.0
Cut down string at pos1 and add string2 from position pos2.
Synopsis
Prototype
AjBool ajStrJoinC (
AjPStr* Pstr,
ajlong pos,
const char* txt,
ajlong posb
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
ajlong | pos | Input | Number of characters to keep in target string. |
const char* | txt | Input | Text to append. |
ajlong | posb | Input | Position of first character to copy from text. |
AjBool | | RETURN | ajTrue on success |
Input
pos: | (Input) | Number of characters to keep in target string. |
txt: | (Input) | Text to append. |
posb: | (Input) | Position of first character to copy from text. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
Description
Cut down string at pos1 and add string2 from position pos2.
See Also
See other functions in this section
Availability
In release 6.4.0
Appends one string to another after cutting both strings.
Cuts down string at pos1 and add string2 from position pos2.
Synopsis
Prototype
AjBool ajStrJoinS (
AjPStr* Pstr,
ajlong pos,
const AjPStr str,
ajlong posb
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
ajlong | pos | Input | Start position in target string,
negative numbers count from the end. |
const AjPStr | str | Input | String to append. |
ajlong | posb | Input | Starts position to copy,
negative numbers count from the end. |
AjBool | | RETURN | ajTrue on success. |
Input
pos: | (Input) | Start position in target string,
negative numbers count from the end. |
str: | (Input) | String to append. |
posb: | (Input) | Starts position to copy,
negative numbers count from the end. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue on success. |
Description
Appends one string to another after cutting both strings.
Cuts down string at pos1 and add string2 from position pos2.
See Also
See other functions in this section
Availability
In release 6.4.0
Masks out characters from a string that are identical to a second string.
Synopsis
Prototype
AjBool ajStrMaskIdent (
AjPStr* Pstr,
const AjPStr str,
char maskchr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const AjPStr | str | Input | Comparison string |
char | maskchr | Input | masking character |
AjBool | | RETURN | ajTrue on success |
Input
str: | (Input) | Comparison string |
maskchr: | (Input) | masking character |
Output
Pstr: | (Output) | Target string |
Returns
Description
Masks out characters from a string that are identical to a second string.
See Also
See other functions in this section
Availability
In release 6.4.0
Masks out characters from a string over a specified range.
Synopsis
Prototype
AjBool ajStrMaskRange (
AjPStr* Pstr,
ajlong pos1,
ajlong pos2,
char maskchr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
ajlong | pos1 | Input | start position to be masked |
ajlong | pos2 | Input | end position to be masked |
char | maskchr | Input | masking character |
AjBool | | RETURN | ajTrue on success, ajFalse if begin is out of range |
Input
pos1: | (Input) | start position to be masked |
pos2: | (Input) | end position to be masked |
maskchr: | (Input) | masking character |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue on success, ajFalse if begin is out of range |
Description
Masks out characters from a string over a specified range.
See Also
See other functions in this section
Availability
In release 6.4.0
Overwrite one string with another.
Replace string at pos1 with new string.
Synopsis
Prototype
AjBool ajStrPasteS (
AjPStr* Pstr,
ajlong pos,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | Position in target string |
const AjPStr | str | Input | String to replace. |
AjBool | | RETURN | ajTrue on success |
Input
pos: | (Input) | Position in target string |
str: | (Input) | String to replace. |
Input & Output
Pstr: | (Modify) | Target string |
Returns
Description
Overwrite one string with another.
Replace string at pos1 with new string.
See Also
See other functions in this section
Availability
In release 6.4.0
Overwrites a string with a number of single characters.
Replace string at pos and add num copies of character chr. Or to the end
of the existing string
Synopsis
Prototype
AjBool ajStrPasteCountK (
AjPStr* Pstr,
ajlong pos,
char chr,
ajulong num
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | position in string |
char | chr | Input | Character to replace. |
ajulong | num | Input | Number of characters to copy from text. |
AjBool | | RETURN | ajTrue on success |
Input
pos: | (Input) | position in string |
chr: | (Input) | Character to replace. |
num: | (Input) | Number of characters to copy from text. |
Input & Output
Pstr: | (Modify) | Target string |
Returns
Description
Overwrites a string with a number of single characters.
Replace string at pos and add num copies of character chr. Or to the end
of the existing string
See Also
See other functions in this section
Availability
In release 6.4.0
Overwrite one string with a specified number of characters from a text
string.
Replaces string at pos ands add len characters from text string txt.
Or to the end of the existing string
Synopsis
Prototype
AjBool ajStrPasteMaxC (
AjPStr* Pstr,
ajlong pos,
const char* txt,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | Start position in target string. |
const char* | txt | Input | String to replace. |
size_t | len | Input | Number of characters to copy from text. |
AjBool | | RETURN | ajTrue on success |
Input
pos: | (Input) | Start position in target string. |
txt: | (Input) | String to replace. |
len: | (Input) | Number of characters to copy from text. |
Input & Output
Pstr: | (Modify) | Target string |
Returns
Description
Overwrite one string with a specified number of characters from a text
string.
Replaces string at pos ands add len characters from text string txt.
Or to the end of the existing string
See Also
See other functions in this section
Availability
In release 6.4.0
Overwrite one string with a specified number of characters from another
string.
Replaces string at pos and add len characters from string str.
Or to the end of the existing string
Synopsis
Prototype
AjBool ajStrPasteMaxS (
AjPStr* Pstr,
ajlong pos,
const AjPStr str,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajlong | pos | Input | Start position in target string. |
const AjPStr | str | Input | Replacement string |
size_t | len | Input | Number of characters to copy from text. |
AjBool | | RETURN | ajTrue on success |
Input
pos: | (Input) | Start position in target string. |
str: | (Input) | Replacement string |
len: | (Input) | Number of characters to copy from text. |
Input & Output
Pstr: | (Modify) | Target string |
Returns
Description
Overwrite one string with a specified number of characters from another
string.
Replaces string at pos and add len characters from string str.
Or to the end of the existing string
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for removing characters or regions (substrings) from a string.
Functions: ajStrCutBraces ajStrCutComments ajStrCutCommentsRestpos ajStrCutCommentsStart ajStrCutEnd ajStrCutRange ajStrCutStart ajStrKeepRange ajStrKeepSetC ajStrKeepSetS ajStrKeepSetAlpha ajStrKeepSetAlphaC ajStrKeepSetAlphaS ajStrKeepSetAlphaRest ajStrKeepSetAlphaRestC ajStrKeepSetAlphaRestS ajStrKeepSetAscii ajStrQuoteStrip ajStrQuoteStripAll ajStrRemoveDupchar ajStrRemoveGap ajStrRemoveGapF ajStrRemoveHtml ajStrRemoveLastNewline ajStrRemoveSetC ajStrRemoveWhite ajStrRemoveWhiteExcess ajStrRemoveWhiteSpaces ajStrRemoveWild ajStrTrimC ajStrTrimEndC ajStrTrimStartC ajStrTrimWhite ajStrTrimWhiteEnd ajStrTrimWhiteStart ajStrTruncateLen ajStrTruncatePos
Removes comments enclosed in braces from a string.
A comment is enclosed in curly braces at the end of a string.
Synopsis
Prototype
AjBool ajStrCutBraces (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Line of text from input file |
AjBool | | RETURN | ajTrue if there is some text remaining |
Input & Output
Pstr: | (Modify) | Line of text from input file |
Returns
AjBool: | ajTrue if there is some text remaining |
Description
Removes comments enclosed in braces from a string.
A comment is enclosed in curly braces at the end of a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes comments from a string.
A comment begins with a "#" character and may appear anywhere in the string.
See ajStrCutCommentsStart for alternative definition of a comment.
Synopsis
Prototype
AjBool ajStrCutComments (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Line of text from input file |
AjBool | | RETURN | ajTrue if there is some text remaining |
Input & Output
Pstr: | (Modify) | Line of text from input file |
Returns
AjBool: | ajTrue if there is some text remaining |
Description
Removes comments from a string.
A comment begins with a "#" character and may appear anywhere in the string.
See ajStrCutCommentsStart for alternative definition of a comment.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes comments from a string.
A comment begins with a "#" character and may appear anywhere in the string.
See ajStrCutCommentsStart for alternative definition of a comment.
Synopsis
Prototype
AjBool ajStrCutCommentsRestpos (
AjPStr* Pstr,
AjPStr* Pcomment,
size_t* Pstartpos
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Line of text from input file |
AjPStr* | Pcomment | Output | Comment characters deleted |
size_t* | Pstartpos | Output | Comment start position |
AjBool | | RETURN | ajTrue if there is some text remaining |
Output
Pcomment: | (Output) | Comment characters deleted |
Pstartpos: | (Output) | Comment start position |
Input & Output
Pstr: | (Modify) | Line of text from input file |
Returns
AjBool: | ajTrue if there is some text remaining |
Description
Removes comments from a string.
A comment begins with a "#" character and may appear anywhere in the string.
See ajStrCutCommentsStart for alternative definition of a comment.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes comments from a string.
A comment is a blank line or any text starting with a "#" character.
Synopsis
Prototype
AjBool ajStrCutCommentsStart (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Line of text from input file |
AjBool | | RETURN | ajTrue if there is some text remaining |
Input & Output
Pstr: | (Modify) | Line of text from input file |
Returns
AjBool: | ajTrue if there is some text remaining |
Description
Removes comments from a string.
A comment is a blank line or any text starting with a "#" character.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes a number of characters from the end of a string
Synopsis
Prototype
AjBool ajStrCutEnd (
AjPStr* Pstr,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
size_t | len | Input | Number of characters to delete from the end |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
len: | (Input) | Number of characters to delete from the end |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes a number of characters from the end of a string
See Also
See other functions in this section
Availability
In release 6.4.0
Removes a substring from a string.
Synopsis
Prototype
AjBool ajStrCutRange (
AjPStr* Pstr,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
ajlong | pos1 | Input | start position to be cut |
ajlong | pos2 | Input | end position to be cut |
AjBool | | RETURN | ajTrue on success, ajFalse if begin is out of range |
Input
pos1: | (Input) | start position to be cut |
pos2: | (Input) | end position to be cut |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue on success, ajFalse if begin is out of range |
Description
Removes a substring from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes a number of characters from the start of a string
Synopsis
Prototype
AjBool ajStrCutStart (
AjPStr* Pstr,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
size_t | len | Input | Number of characters to delete from the start |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
len: | (Input) | Number of characters to delete from the start |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes a number of characters from the start of a string
See Also
See other functions in this section
Availability
In release 6.4.0
Reduces target string to a substring of itself by deleting all except
a range of character positions.
The end is allowed to be before begin, in which case the output is an
empty string.
Synopsis
Prototype
AjBool ajStrKeepRange (
AjPStr* Pstr,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string. |
ajlong | pos1 | Input | Start position for substring. |
ajlong | pos2 | Input | End position for substring. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
pos1: | (Input) | Start position for substring. |
pos2: | (Input) | End position for substring. |
Output
Pstr: | (Output) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Reduces target string to a substring of itself by deleting all except
a range of character positions.
The end is allowed to be before begin, in which case the output is an
empty string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not in a given set.
Synopsis
Prototype
AjBool ajStrKeepSetC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
const char* | txt | Input | Character set to keep |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Character set to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes all characters from a string that are not in a given set.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not in a given set.
Synopsis
Prototype
AjBool ajStrKeepSetS (
AjPStr* Pstr,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
const AjPStr | str | Input | Character set to keep |
AjBool | | RETURN | ajTrue if string is not empty |
Input
str: | (Input) | Character set to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not in a given set.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not alphabetic.
Synopsis
Prototype
AjBool ajStrKeepSetAlpha (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
AjBool | | RETURN | ajTrue if string is not empty |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not alphabetic.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not alphabetic and
are not in a given set.
Synopsis
Prototype
AjBool ajStrKeepSetAlphaC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
const char* | txt | Input | Non-alphabetic character set to keep |
AjBool | | RETURN | ajTrue if string is not empty |
Input
txt: | (Input) | Non-alphabetic character set to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not alphabetic and
are not in a given set.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not alphabetic and
are not in a given set.
Synopsis
Prototype
AjBool ajStrKeepSetAlphaS (
AjPStr* Pstr,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
const AjPStr | str | Input | Non-alphabetic character set to keep |
AjBool | | RETURN | ajTrue if string is not empty |
Input
str: | (Input) | Non-alphabetic character set to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not alphabetic and
are not in a given set.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not alphabetic.
Also returns any non-whitespace characters in the strings
Synopsis
Prototype
AjBool ajStrKeepSetAlphaRest (
AjPStr* Pstr,
AjPStr* Prest
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
AjPStr* | Prest | Modify | Excluded non-whitespace characters. |
AjBool | | RETURN | ajTrue if string is not empty |
Input & Output
Pstr: | (Modify) | String to clean. |
Prest: | (Modify) | Excluded non-whitespace characters. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not alphabetic.
Also returns any non-whitespace characters in the strings
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not alphabetic and
are not in a given set.
Also returns any non-whitespace characters in the strings
Synopsis
Prototype
AjBool ajStrKeepSetAlphaRestC (
AjPStr* Pstr,
const char* txt,
AjPStr* Prest
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
const char* | txt | Input | Non-alphabetic character set to keep |
AjPStr* | Prest | Modify | Excluded non-whitespace characters. |
AjBool | | RETURN | ajTrue if string is not empty |
Input
txt: | (Input) | Non-alphabetic character set to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Prest: | (Modify) | Excluded non-whitespace characters. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not alphabetic and
are not in a given set.
Also returns any non-whitespace characters in the strings
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not alphabetic and
are not in a given set.
Also returns any non-whitespace characters in the strings
Synopsis
Prototype
AjBool ajStrKeepSetAlphaRestS (
AjPStr* Pstr,
const AjPStr str,
AjPStr* Prest
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
const AjPStr | str | Input | Non-alphabetic character set to keep |
AjPStr* | Prest | Modify | Excluded non-whitespace characters. |
AjBool | | RETURN | ajTrue if string is not empty |
Input
str: | (Input) | Non-alphabetic character set to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Prest: | (Modify) | Excluded non-whitespace characters. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not alphabetic and
are not in a given set.
Also returns any non-whitespace characters in the strings
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters from a string that are not within a range of
ASCII character codes.
Synopsis
Prototype
AjBool ajStrKeepSetAscii (
AjPStr* Pstr,
int minchar,
int maxchar
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
int | minchar | Input | Lowest ASCII code to keep |
int | maxchar | Input | Highest ASCII code to keep |
AjBool | | RETURN | ajTrue if string is not empty |
Input
minchar: | (Input) | Lowest ASCII code to keep |
maxchar: | (Input) | Highest ASCII code to keep |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes all characters from a string that are not within a range of
ASCII character codes.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes any double quotes from a string.
Internal escaped or double quotes are converted to single quotes.
Synopsis
Prototype
AjBool ajStrQuoteStrip (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
AjBool | | RETURN | ajTrue if string is not empty |
Input & Output
Returns
AjBool: | ajTrue if string is not empty |
Description
Removes any double quotes from a string.
Internal escaped or double quotes are converted to single quotes.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes any single or double quotes from a string.
Internal escaped or doubled-up quotes are converted to single quotes.
Synopsis
Prototype
AjBool ajStrQuoteStripAll (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
AjBool | | RETURN | True on success |
Input & Output
Returns
Description
Removes any single or double quotes from a string.
Internal escaped or doubled-up quotes are converted to single quotes.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes duplicate characters from a string
Synopsis
Prototype
AjBool ajStrRemoveDupchar (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | True if string is not empty |
Output
Returns
AjBool: | True if string is not empty |
Description
Removes duplicate characters from a string
See Also
See other functions in this section
Availability
In release 6.4.0
Removes non-sequence characters (all but alphabetic characters and asterisk)
from a string.
Synopsis
Prototype
AjBool ajStrRemoveGap (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | True if string is not empty |
Output
Returns
AjBool: | True if string is not empty |
Description
Removes non-sequence characters (all but alphabetic characters and asterisk)
from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes non-sequence characters (all but alphabetic characters and asterisk)
from a string. Also removes floats from an array of the same size
Synopsis
Prototype
AjBool ajStrRemoveGapF (
AjPStr* Pstr,
float* Pfloat
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
float* | Pfloat | Output | Floating point array (e.g. quality scores) |
AjBool | | RETURN | True if string is not empty |
Output
Pstr: | (Output) | String |
Pfloat: | (Output) | Floating point array (e.g. quality scores) |
Returns
AjBool: | True if string is not empty |
Description
Removes non-sequence characters (all but alphabetic characters and asterisk)
from a string. Also removes floats from an array of the same size
See Also
See other functions in this section
Availability
In release 6.4.0
Removes html from a string.
html is defined as all substrings between and including angle brackets.
Synopsis
Prototype
AjBool ajStrRemoveHtml (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | ajTrue on success |
Output
Returns
Description
Removes html from a string.
html is defined as all substrings between and including angle brackets.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes last character from a string if it is a newline character.
Synopsis
Prototype
AjBool ajStrRemoveLastNewline (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
AjBool | | RETURN | True is string is not empty |
Output
Returns
AjBool: | True is string is not empty |
Description
Removes last character from a string if it is a newline character.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all of a given set of characters from a string.
Synopsis
Prototype
AjBool ajStrRemoveSetC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
const char* | txt | Input | characters to remove |
AjBool | | RETURN | True on success |
Input
txt: | (Input) | characters to remove |
Output
Returns
Description
Removes all of a given set of characters from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all whitespace characters from a string.
Synopsis
Prototype
AjBool ajStrRemoveWhite (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes all whitespace characters from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes excess whitespace characters from a string.
Leading/trailing whitespace removed. Multiple spaces replaced by single
spaces.
Synopsis
Prototype
AjBool ajStrRemoveWhiteExcess (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes excess whitespace characters from a string.
Leading/trailing whitespace removed. Multiple spaces replaced by single
spaces.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes excess space characters from a string.
Leading/trailing whitespace removed. Multiple spaces replaced by single
spaces. Tabs converted to spaces. Newlines left unchanged
Synopsis
Prototype
AjBool ajStrRemoveWhiteSpaces (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String to clean. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Pstr: | (Modify) | String to clean. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes excess space characters from a string.
Leading/trailing whitespace removed. Multiple spaces replaced by single
spaces. Tabs converted to spaces. Newlines left unchanged
See Also
See other functions in this section
Availability
In release 6.4.0
Removes all characters after the first wildcard character (if found).
Synopsis
Prototype
AjBool ajStrRemoveWild (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if the string contained a wildcard and was
truncated. |
Input & Output
Returns
AjBool: | ajTrue if the string contained a wildcard and was
truncated. |
Description
Removes all characters after the first wildcard character (if found).
See Also
See other functions in this section
Availability
In release 6.4.0
Removes regions with a given character composition from start and end of a
string.
Synopsis
Prototype
AjBool ajStrTrimC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
const char* | txt | Input | Characters to delete from each end |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Characters to delete from each end |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes regions with a given character composition from start and end of a
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes a region with a given character composition from end of a string.
Synopsis
Prototype
AjBool ajStrTrimEndC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
const char* | txt | Input | Characters to delete from the end |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Characters to delete from the end |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes a region with a given character composition from end of a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes a region with a given character composition from start of a string.
Synopsis
Prototype
AjBool ajStrTrimStartC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
const char* | txt | Input | Characters to delete from the end |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Characters to delete from the end |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes a region with a given character composition from start of a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes regions composed of white space characters only from the start and
end of a string.
Synopsis
Prototype
AjBool ajStrTrimWhite (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes regions composed of white space characters only from the start and
end of a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes regions composed of white space characters only from the end of a
string.
Synopsis
Prototype
AjBool ajStrTrimWhiteEnd (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes regions composed of white space characters only from the end of a
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes regions composed of white space characters only from the start of a
string.
Synopsis
Prototype
AjBool ajStrTrimWhiteStart (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes regions composed of white space characters only from the start of a
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes the end from a string reducing it to a defined length.
Synopsis
Prototype
AjBool ajStrTruncateLen (
AjPStr* Pstr,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
size_t | len | Input | Length of required string. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
len: | (Input) | Length of required string. |
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Removes the end from a string reducing it to a defined length.
See Also
See other functions in this section
Availability
In release 6.4.0
Removes the end from a string by cutting at a defined position.
Synopsis
Prototype
AjBool ajStrTruncatePos (
AjPStr* Pstr,
ajlong pos
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | target string |
ajlong | pos | Input | First position to be deleted. Negative values
count from the end |
AjBool | | RETURN | True is string was reallocated |
Input
pos: | (Input) | First position to be deleted. Negative values
count from the end |
Input & Output
Pstr: | (Modify) | target string |
Returns
AjBool: | True is string was reallocated |
Description
Removes the end from a string by cutting at a defined position.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for substitutions of characters or regions (substrings)
within a string.
Functions: ajStrExchangeCC ajStrExchangeCS ajStrExchangeKK ajStrExchangeSC ajStrExchangeSS ajStrExchangePosCC ajStrExchangeSetCC ajStrExchangeSetSS ajStrExchangeSetRestCK ajStrExchangeSetRestSK ajStrRandom ajStrReverse
Replace all occurrences in a string of one substring with another.
Synopsis
Prototype
AjBool ajStrExchangeCC (
AjPStr* Pstr,
const char* txt,
const char* txtnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
const char* | txt | Input | string to replace. |
const char* | txtnew | Input | string to insert. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | string to replace. |
txtnew: | (Input) | string to insert. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one substring with another.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one substring with another.
Synopsis
Prototype
AjBool ajStrExchangeCS (
AjPStr* Pstr,
const char* txt,
const AjPStr strnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
const char* | txt | Input | string to replace. |
const AjPStr | strnew | Input | string to insert. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | string to replace. |
strnew: | (Input) | string to insert. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one substring with another.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one character with another.
Synopsis
Prototype
AjBool ajStrExchangeKK (
AjPStr* Pstr,
char chr,
char chrnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
char | chr | Input | Character to replace. |
char | chrnew | Input | Character to insert. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
chr: | (Input) | Character to replace. |
chrnew: | (Input) | Character to insert. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one character with another.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one substring with another.
Synopsis
Prototype
AjBool ajStrExchangeSC (
AjPStr* Pstr,
const AjPStr str,
const char* txtnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
const AjPStr | str | Input | string to replace. |
const char* | txtnew | Input | string to insert. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | string to replace. |
txtnew: | (Input) | string to insert. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one substring with another.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one substring with another.
Synopsis
Prototype
AjBool ajStrExchangeSS (
AjPStr* Pstr,
const AjPStr str,
const AjPStr strnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
const AjPStr | str | Input | string to replace. |
const AjPStr | strnew | Input | string to insert. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | string to replace. |
strnew: | (Input) | string to insert. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one substring with another.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace one substring with another at a given position in the text.
Synopsis
Prototype
AjBool ajStrExchangePosCC (
AjPStr* Pstr,
ajlong ipos,
const char* txt,
const char* txtnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string. |
ajlong | ipos | Input | Position in the string, negative values are
from the end of the string. |
const char* | txt | Input | string to replace. |
const char* | txtnew | Input | string to insert. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
ipos: | (Input) | Position in the string, negative values are
from the end of the string. |
txt: | (Input) | string to replace. |
txtnew: | (Input) | string to insert. |
Input & Output
Pstr: | (Modify) | Target string. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace one substring with another at a given position in the text.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one set of characters with another
set.
Synopsis
Prototype
AjBool ajStrExchangeSetCC (
AjPStr* Pstr,
const char* txt,
const char* txtnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
const char* | txt | Input | Unwanted characters |
const char* | txtnew | Input | Replacement characters |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Unwanted characters |
txtnew: | (Input) | Replacement characters |
Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one set of characters with another
set.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one set of characters with another
set.
Synopsis
Prototype
AjBool ajStrExchangeSetSS (
AjPStr* Pstr,
const AjPStr str,
const AjPStr strnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
const AjPStr | str | Input | Unwanted characters |
const AjPStr | strnew | Input | Replacement characters |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | Unwanted characters |
strnew: | (Input) | Replacement characters |
Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one set of characters with another
set.
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string of one set of characters with
a substitute character
Synopsis
Prototype
AjBool ajStrExchangeSetRestCK (
AjPStr* Pstr,
const char* txt,
char chrnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
const char* | txt | Input | Wanted characters |
char | chrnew | Input | Replacement character |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
txt: | (Input) | Wanted characters |
chrnew: | (Input) | Replacement character |
Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string of one set of characters with
a substitute character
See Also
See other functions in this section
Availability
In release 6.4.0
Replace all occurrences in a string not in one set of characters with
a substitute character.
Synopsis
Prototype
AjBool ajStrExchangeSetRestSK (
AjPStr* Pstr,
const AjPStr str,
char chrnew
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
const AjPStr | str | Input | Wanted characters |
char | chrnew | Input | Replacement character |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
str: | (Input) | Wanted characters |
chrnew: | (Input) | Replacement character |
Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Replace all occurrences in a string not in one set of characters with
a substitute character.
See Also
See other functions in this section
Availability
In release 6.4.0
Randomly rearranges the characters in a string.
The application code must first call ajRandomSeed().
Synopsis
Prototype
AjBool ajStrRandom (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
AjBool | | RETURN | True unless string is empty |
Input & Output
Returns
AjBool: | True unless string is empty |
Description
Randomly rearranges the characters in a string.
The application code must first call ajRandomSeed().
See Also
See other functions in this section
Availability
In release 6.4.0
Reverses the order of characters in a string
Synopsis
Prototype
AjBool ajStrReverse (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
AjBool | | RETURN | ajTrue if string was reallocated |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Reverses the order of characters in a string
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for querying the properties of strings.
Functions: ajStrCalcCountC ajStrCalcCountK ajStrHasParentheses ajStrIsAlnum ajStrIsAlpha ajStrIsBool ajStrIsCharsetC ajStrIsCharsetS ajStrIsCharsetCaseC ajStrIsCharsetCaseS ajStrIsDouble ajStrIsFloat ajStrIsHex ajStrIsInt ajStrIsLong ajStrIsLower ajStrIsNum ajStrIsUpper ajStrIsWhite ajStrIsWild ajStrIsWord ajStrWhole
Counts occurrences of set of characters in a string.
Synopsis
Prototype
ajulong ajStrCalcCountC (
const AjPStr str,
const char* txt
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt | Input | Characters to count |
ajulong | | RETURN | Number of times characters were found in string |
Input
str: | (Input) | String |
txt: | (Input) | Characters to count |
Returns
ajulong: | Number of times characters were found in string |
Description
Counts occurrences of set of characters in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Counts occurrences of a character in a string.
Synopsis
Prototype
ajulong ajStrCalcCountK (
const AjPStr str,
char chr
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | chr | Input | Character to count |
ajulong | | RETURN | Number of times character was found in string |
Input
str: | (Input) | String |
chr: | (Input) | Character to count |
Returns
ajulong: | Number of times character was found in string |
Description
Counts occurrences of a character in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string contains (possibly nested) pairs of parentheses.
Pairs of parentheses are difficult to test for with regular expressions.
Synopsis
Prototype
AjBool ajStrHasParentheses (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to test |
AjBool | | RETURN | ajTrue if string has zero or more () pairs
with possibly other text |
Input
str: | (Input) | String to test |
Returns
AjBool: | ajTrue if string has zero or more () pairs
with possibly other text |
Description
Tests whether a string contains (possibly nested) pairs of parentheses.
Pairs of parentheses are difficult to test for with regular expressions.
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains alphanumeric characters only (no white
space).
The test is defined by isalnum in the C RTL plus underscores.
Synopsis
Prototype
AjBool ajStrIsAlnum (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is entirely alphanumeric |
Input
Returns
AjBool: | ajTrue if the string is entirely alphanumeric |
Description
Test whether a string contains alphanumeric characters only (no white
space).
The test is defined by isalnum in the C RTL plus underscores.
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains alphabetic characters only (no white space).
Test is defined by isalpha in the C RTL.
Synopsis
Prototype
AjBool ajStrIsAlpha (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is entirely alphabetic |
Input
Returns
AjBool: | ajTrue if the string is entirely alphabetic |
Description
Test whether a string contains alphabetic characters only (no white space).
Test is defined by isalpha in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string represents a valid Boolean value.
The string must be a single character boolean value, or one of "yes, "no",
"true" or "false".
Synopsis
Prototype
AjBool ajStrIsBool (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is acceptable as a boolean. |
Input
Returns
AjBool: | ajTrue if the string is acceptable as a boolean. |
Description
Tests whether a string represents a valid Boolean value.
The string must be a single character boolean value, or one of "yes, "no",
"true" or "false".
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains specified characters only.
Synopsis
Prototype
AjBool ajStrIsCharsetC (
const AjPStr str,
const char* txt
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt | Input | Character set to test |
AjBool | | RETURN | ajTrue if the string is entirely composed of characters
in the specified set |
Input
str: | (Input) | String |
txt: | (Input) | Character set to test |
Returns
AjBool: | ajTrue if the string is entirely composed of characters
in the specified set |
Description
Test whether a string contains specified characters only.
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains specified characters only.
Synopsis
Prototype
AjBool ajStrIsCharsetS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Character set to test |
AjBool | | RETURN | ajTrue if the string is entirely composed of characters
in the specified set |
Input
str: | (Input) | String |
str2: | (Input) | Character set to test |
Returns
AjBool: | ajTrue if the string is entirely composed of characters
in the specified set |
Description
Test whether a string contains specified characters only.
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains specified characters only.
The test is case-insensitive
Synopsis
Prototype
AjBool ajStrIsCharsetCaseC (
const AjPStr str,
const char* txt
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt | Input | Character set to test |
AjBool | | RETURN | ajTrue if the string is entirely composed of characters
in the specified set |
Input
str: | (Input) | String |
txt: | (Input) | Character set to test |
Returns
AjBool: | ajTrue if the string is entirely composed of characters
in the specified set |
Description
Test whether a string contains specified characters only.
The test is case-insensitive
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains specified characters only.
The test is case-insensitive
Synopsis
Prototype
AjBool ajStrIsCharsetCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Character set to test |
AjBool | | RETURN | ajTrue if the string is entirely composed of characters
in the specified set |
Input
str: | (Input) | String |
str2: | (Input) | Character set to test |
Returns
AjBool: | ajTrue if the string is entirely composed of characters
in the specified set |
Description
Test whether a string contains specified characters only.
The test is case-insensitive
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string represents a valid double precision value,
Test uses the strtod call in the C RTL.
Synopsis
Prototype
AjBool ajStrIsDouble (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is acceptable as a double
precision number. |
Input
Returns
AjBool: | ajTrue if the string is acceptable as a double
precision number. |
Description
Tests whether a string represents a valid double precision value,
Test uses the strtod call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string represents a valid floating point value.
Test uses the strtod call in the C RTL.
Synopsis
Prototype
AjBool ajStrIsFloat (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is acceptable as a floating
point number. |
Input
Returns
AjBool: | ajTrue if the string is acceptable as a floating
point number. |
Description
Tests whether a string represents a valid floating point value.
Test uses the strtod call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string represents a valid hexadecimal value.
Test uses the strtol call in the C RTL.
Synopsis
Prototype
AjBool ajStrIsHex (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is acceptable as a hexadecimal value. |
Input
Returns
AjBool: | ajTrue if the string is acceptable as a hexadecimal value. |
Description
Tests whether a string represents a valid hexadecimal value.
Test uses the strtol call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string represents a valid integer value.
Test uses the strtol call in the C RTL.
Synopsis
Prototype
AjBool ajStrIsInt (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is acceptable as an integer. |
Input
Returns
AjBool: | ajTrue if the string is acceptable as an integer. |
Description
Tests whether a string represents a valid integer value.
Test uses the strtol call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string represents a valid ajlong integer value.
Test uses the strtol call in the C RTL.
Synopsis
Prototype
AjBool ajStrIsLong (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is acceptable as an integer. |
Input
Returns
AjBool: | ajTrue if the string is acceptable as an integer. |
Description
Tests whether a string represents a valid ajlong integer value.
Test uses the strtol call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string contains no upper case alphabetic characters.
Test is defined by isupper in the C RTL..
Synopsis
Prototype
AjBool ajStrIsLower (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is entirely alphabetic |
Input
Returns
AjBool: | ajTrue if the string is entirely alphabetic |
Description
Tests whether a string contains no upper case alphabetic characters.
Test is defined by isupper in the C RTL..
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains decimal digits only.
Test is defined by isdigit in the C RTL..
Synopsis
Prototype
AjBool ajStrIsNum (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is entirely numeric |
Input
Returns
AjBool: | ajTrue if the string is entirely numeric |
Description
Test whether a string contains decimal digits only.
Test is defined by isdigit in the C RTL..
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains no lower case alphabetic characters.
Test is defined by islower in the C RTL..
Synopsis
Prototype
AjBool ajStrIsUpper (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string has no lower case characters. |
Input
Returns
AjBool: | ajTrue if the string has no lower case characters. |
Description
Test whether a string contains no lower case alphabetic characters.
Test is defined by islower in the C RTL..
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains whitespace characters only.
The test is made using the strtod call in the C RTL.
Synopsis
Prototype
AjBool ajStrIsWhite (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string is only white space (or empty). |
Input
Returns
AjBool: | ajTrue if the string is only white space (or empty). |
Description
Test whether a string contains whitespace characters only.
The test is made using the strtod call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string contains the standard wildcard characters * or ?.
Synopsis
Prototype
AjBool ajStrIsWild (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if string has wildcards. |
Input
Returns
AjBool: | ajTrue if string has wildcards. |
Description
Tests whether a string contains the standard wildcard characters * or ?.
See Also
See other functions in this section
Availability
In release 6.4.0
Test whether a string contains no white space characters.
Test is defined by isspace in the C RTL.
Synopsis
Prototype
AjBool ajStrIsWord (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if the string has no white space |
Input
Returns
AjBool: | ajTrue if the string has no white space |
Description
Test whether a string contains no white space characters.
Test is defined by isspace in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a range refers to the whole string
Synopsis
Prototype
AjBool ajStrWhole (
const AjPStr str,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajlong | pos1 | Input | Begin position (0 start, negative from the end) |
ajlong | pos2 | Input | Begin position (0 start, negative from the end) |
AjBool | | RETURN | ajTrue is range covers the whole string |
Input
str: | (Input) | String |
pos1: | (Input) | Begin position (0 start, negative from the end) |
pos2: | (Input) | Begin position (0 start, negative from the end) |
Returns
AjBool: | ajTrue is range covers the whole string |
Description
Tests whether a range refers to the whole string
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for returning elements of a string object.
Functions: ajStrGetAsciiCommon ajStrGetAsciiHigh ajStrGetAsciiLow ajStrGetCharFirst ajStrGetCharLast ajStrGetCharPos ajStrGetLen MAJSTRGETLEN ajStrGetPtr MAJSTRGETPTR ajStrGetRes MAJSTRGETRES ajStrGetRoom ajStrGetUse MAJSTRGETUSE ajStrGetValid
Returns the most common ASCII character code in a string.
Synopsis
Prototype
char ajStrGetAsciiCommon (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | | RETURN | Most common character or null character if empty. |
Input
Returns
char: | Most common character or null character if empty. |
Description
Returns the most common ASCII character code in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the highest ASCII character code in a string.
Synopsis
Prototype
char ajStrGetAsciiHigh (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | | RETURN | Highest character or null character if empty. |
Input
Returns
char: | Highest character or null character if empty. |
Description
Returns the highest ASCII character code in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the lowest ASCII character code in a string.
Synopsis
Prototype
char ajStrGetAsciiLow (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | | RETURN | Lowest character or null character if empty. |
Input
Returns
char: | Lowest character or null character if empty. |
Description
Returns the lowest ASCII character code in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the first character from a string.
Synopsis
Prototype
char ajStrGetCharFirst (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | | RETURN | First character or null character if empty. |
Input
Returns
char: | First character or null character if empty. |
Description
Returns the first character from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the last character from a string.
Synopsis
Prototype
char ajStrGetCharLast (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | | RETURN | Last character or null character if empty. |
Input
Returns
char: | Last character or null character if empty. |
Description
Returns the last character from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns a single character at a given position from a string.
Synopsis
Prototype
char ajStrGetCharPos (
const AjPStr str,
ajlong pos
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajlong | pos | Input | Position in the string, negative values are
from the end of the string. |
char | | RETURN | Character at position pos or null character if out of range. |
Input
str: | (Input) | String |
pos: | (Input) | Position in the string, negative values are
from the end of the string. |
Returns
char: | Character at position pos or null character if out of range. |
Description
Returns a single character at a given position from a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current length of the C (char *) string.
The length will remain valid unless the string is resized or deleted.
Synopsis
Prototype
size_t ajStrGetLen (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Source string |
size_t | | RETURN | Current string length |
Input
Returns
size_t: | Current string length |
Description
Returns the current length of the C (char *) string.
The length will remain valid unless the string is resized or deleted.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current length of the C (char *) string.
A macro version of {ajStrGetLen} available in case it is needed for speed.
Input
Returns
size_t: | Current string length |
Description
Returns the current length of the C (char *) string.
A macro version of {ajStrGetLen} available in case it is needed for speed.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current pointer to C (char *) string.
The pointer will remain valid unless the string is resized or deleted.
Synopsis
Prototype
const char* ajStrGetPtr (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Source string |
const char* | | RETURN | Current string pointer, or a null string if undefined. |
Input
Returns
const char*: | Current string pointer, or a null string if undefined. |
Description
Returns the current pointer to C (char *) string.
The pointer will remain valid unless the string is resized or deleted.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current pointer to C (char *) string.
A macro version of {ajStrGetPtr} available in case it is needed for speed.
Input
Returns
const char*: | Current string pointer, or a null string if undefined. |
Description
Returns the current pointer to C (char *) string.
A macro version of {ajStrGetPtr} available in case it is needed for speed.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current reserved size of the C (char *) string.
The reserved size will remain valid unless the string is resized or deleted.
Synopsis
Prototype
size_t ajStrGetRes (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Source string |
size_t | | RETURN | Current string reserved size |
Input
Returns
size_t: | Current string reserved size |
Description
Returns the current reserved size of the C (char *) string.
The reserved size will remain valid unless the string is resized or deleted.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current reserved size of the C (char *) string.
A macro version of {ajStrGetRes} available in case it is needed for speed.
Input
Returns
size_t: | Current string reserved size |
Description
Returns the current reserved size of the C (char *) string.
A macro version of {ajStrGetRes} available in case it is needed for speed.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the additional space available in a string before it would require
reallocating.
Synopsis
Prototype
size_t ajStrGetRoom (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
size_t | | RETURN | Space available for additional characters. |
Input
Returns
size_t: | Space available for additional characters. |
Description
Returns the additional space available in a string before it would require
reallocating.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current usage count of the C (char *) string.
The usage count will remain valid unless the string is resized or deleted.
Synopsis
Prototype
ajuint ajStrGetUse (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Source string |
ajuint | | RETURN | Current string usage count |
Input
Returns
ajuint: | Current string usage count |
Description
Returns the current usage count of the C (char *) string.
The usage count will remain valid unless the string is resized or deleted.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the current usage count of the C (char *) string.
A macro version of {ajStrGetUse} available in case it is needed for speed.
Input
Returns
ajuint: | Current string usage count |
Description
Returns the current usage count of the C (char *) string.
A macro version of {ajStrGetUse} available in case it is needed for speed.
See Also
See other functions in this section
Availability
In release 6.4.0
Checks a string object for consistency.
Intended for debugging and testing of these routines, but made publicly
available.
Synopsis
Prototype
AjBool ajStrGetValid (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool | | RETURN | ajTrue if no errors were found. |
Input
Returns
AjBool: | ajTrue if no errors were found. |
Description
Checks a string object for consistency.
Intended for debugging and testing of these routines, but made publicly
available.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for returning elements of a string object.
Functions: ajStrGetuniquePtr MAJSTRGETUNIQUESTR ajStrGetuniqueStr
Makes the string value unique by copying any string with a reference count
of more than 1, and returns the current C (char *) pointer.
As the input string is not const, the calling program must be able
to modify it in order to call this function.
If the length of the string is changed, it is the responsibility of
the caller to reset it with ajStrSetValid
Synopsis
Prototype
char* ajStrGetuniquePtr (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Source string |
char* | | RETURN | Current string pointer, or a null string if undefined. |
Input & Output
Pstr: | (Modify) | Source string |
Returns
char*: | Current string pointer, or a null string if undefined. |
Description
Makes the string value unique by copying any string with a reference count
of more than 1, and returns the current C (char *) pointer.
As the input string is not const, the calling program must be able
to modify it in order to call this function.
If the length of the string is changed, it is the responsibility of
the caller to reset it with ajStrSetValid
See Also
See other functions in this section
Availability
In release 6.4.0
Make certain a string is modifiable by checking it has no other references,
or by making a new real copy of the string.
Uses strCloneL to copy without copying the reference count.
The target string is guaranteed to have a reference count of exactly 1.
A macro version of {ajStrGetuniqueStr} in case it is needed for speed
Input & Output
Returns
AjPStr: | The new string pointer, or NULL for failure |
Description
Make certain a string is modifiable by checking it has no other references,
or by making a new real copy of the string.
Uses strCloneL to copy without copying the reference count.
The target string is guaranteed to have a reference count of exactly 1.
A macro version of {ajStrGetuniqueStr} in case it is needed for speed
See Also
See other functions in this section
Availability
In release 6.4.0
Make certain a string is modifiable by checking it has no other references,
or by making a new real copy of the string.
Uses strCloneL to copy without copying the reference count.
The target string is guaranteed to have a reference count of exactly 1.
Synopsis
Prototype
AjPStr ajStrGetuniqueStr (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjPStr | | RETURN | The new string pointer, or NULL for failure |
Input & Output
Returns
AjPStr: | The new string pointer, or NULL for failure |
Description
Make certain a string is modifiable by checking it has no other references,
or by making a new real copy of the string.
Uses strCloneL to copy without copying the reference count.
The target string is guaranteed to have a reference count of exactly 1.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for assigning elements of a string object.
Functions: ajStrSetClear ajStrSetRes ajStrSetResRound ajStrSetValid ajStrSetValidLen
Clears all elements in a string object.
If the string is already empty nothing happens. If the string has data,
it makes sure the string is modifiable and sets it to empty.
Synopsis
Prototype
AjBool ajStrSetClear (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Pointer to the string to be deleted.
The pointer is always deleted. |
AjBool | | RETURN | ajTrue if string was reallocated |
Output
Pstr: | (Output) | Pointer to the string to be deleted.
The pointer is always deleted. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Clears all elements in a string object.
If the string is already empty nothing happens. If the string has data,
it makes sure the string is modifiable and sets it to empty.
See Also
See other functions in this section
Availability
In release 6.4.0
Ensures a string is modifiable and big enough for its intended purpose.
The target string is guaranteed to have a reference count of 1 and a
minimum reserved size.
Synopsis
Prototype
AjBool ajStrSetRes (
AjPStr* Pstr,
size_t size
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
size_t | size | Input | Minimum reserved size. |
AjBool | | RETURN | ajTrue if the string was reallocated |
Input
size: | (Input) | Minimum reserved size. |
Input & Output
Returns
AjBool: | ajTrue if the string was reallocated |
Description
Ensures a string is modifiable and big enough for its intended purpose.
The target string is guaranteed to have a reference count of 1 and a
minimum reserved size.
See Also
See other functions in this section
Availability
In release 6.4.0
Ensures a string is modifiable and big enough for its intended purpose.
The target string is guaranteed to have a reference count of 1,
and a minimum reserved size. The string size is rounded up.
Synopsis
Prototype
AjBool ajStrSetResRound (
AjPStr* Pstr,
size_t size
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String |
size_t | size | Input | Minimum reserved size. |
AjBool | | RETURN | ajTrue if the string was reallocated |
Input
size: | (Input) | Minimum reserved size. |
Output
Returns
AjBool: | ajTrue if the string was reallocated |
Description
Ensures a string is modifiable and big enough for its intended purpose.
The target string is guaranteed to have a reference count of 1,
and a minimum reserved size. The string size is rounded up.
See Also
See other functions in this section
Availability
In release 6.4.0
Reset string length when some nasty caller may have edited it
Synopsis
Prototype
AjBool ajStrSetValid (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String. |
AjBool | | RETURN | True on success. |
Input & Output
Returns
Description
Reset string length when some nasty caller may have edited it
See Also
See other functions in this section
Availability
In release 6.4.0
Reset string length when some nasty caller may have edited it
Synopsis
Prototype
AjBool ajStrSetValidLen (
AjPStr* Pstr,
size_t len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
size_t | len | Input | Length expected. |
AjBool | | RETURN | True on success |
Input
len: | (Input) | Length expected. |
Input & Output
Returns
Description
Reset string length when some nasty caller may have edited it
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for converting strings to other datatypes.
Functions: ajStrToBool ajStrToDouble ajStrToFloat ajStrToHex ajStrToInt ajStrToLong ajStrToUint ajStrToUlong
Converts a string into a Boolean value.
Synopsis
Prototype
AjBool ajStrToBool (
const AjPStr str,
AjBool* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjBool* | Pval | Output | ajTrue if the string is "true" as a boolean. |
AjBool | | RETURN | ajTrue if the string had a valid boolean value. |
Input
Output
Pval: | (Output) | ajTrue if the string is "true" as a boolean. |
Returns
AjBool: | ajTrue if the string had a valid boolean value. |
Description
Converts a string into a Boolean value.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string into a double precision value.
Uses the strtod call in the C RTL.
Synopsis
Prototype
AjBool ajStrToDouble (
const AjPStr str,
double* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
double* | Pval | Output | String represented as a double precision number. |
AjBool | | RETURN | ajTrue if the string had a valid double precision value. |
Input
Output
Pval: | (Output) | String represented as a double precision number. |
Returns
AjBool: | ajTrue if the string had a valid double precision value. |
Description
Converts a string into a double precision value.
Uses the strtod call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string into a floating point value.
Uses the strtod call in the C RTL.
Synopsis
Prototype
AjBool ajStrToFloat (
const AjPStr str,
float* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
float* | Pval | Output | String represented as a floating point number. |
AjBool | | RETURN | ajTrue if the string had a valid floating point value. |
Input
Output
Pval: | (Output) | String represented as a floating point number. |
Returns
AjBool: | ajTrue if the string had a valid floating point value. |
Description
Converts a string into a floating point value.
Uses the strtod call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string from hexadecimal into an integer value.
Uses the strtol call in the C RTL.
Synopsis
Prototype
AjBool ajStrToHex (
const AjPStr str,
ajint* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajint* | Pval | Output | String represented as an integer. |
AjBool | | RETURN | ajTrue if the string had a valid hexadecimal value. |
Input
Output
Pval: | (Output) | String represented as an integer. |
Returns
AjBool: | ajTrue if the string had a valid hexadecimal value. |
Description
Converts a string from hexadecimal into an integer value.
Uses the strtol call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string into an integer value.
Uses the strtol call in the C RTL.
Synopsis
Prototype
AjBool ajStrToInt (
const AjPStr str,
ajint* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajint* | Pval | Output | String represented as an integer. |
AjBool | | RETURN | ajTrue if the string had a valid integer value. |
Input
Output
Pval: | (Output) | String represented as an integer. |
Returns
AjBool: | ajTrue if the string had a valid integer value. |
Description
Converts a string into an integer value.
Uses the strtol call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string into an integer value.
Uses the strtol call in the C RTL.
Synopsis
Prototype
AjBool ajStrToLong (
const AjPStr str,
ajlong* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajlong* | Pval | Output | String represented as an integer. |
AjBool | | RETURN | ajTrue if the string had a valid integer value. |
Input
Output
Pval: | (Output) | String represented as an integer. |
Returns
AjBool: | ajTrue if the string had a valid integer value. |
Description
Converts a string into an integer value.
Uses the strtol call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string into an unsigned integer value.
Uses the strtoul call in the C RTL from C89 onwards.
Synopsis
Prototype
AjBool ajStrToUint (
const AjPStr str,
ajuint* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajuint* | Pval | Output | String represented as an unsigned integer. |
AjBool | | RETURN | ajTrue if the string had a valid unsigned integer value. |
Input
Output
Pval: | (Output) | String represented as an unsigned integer. |
Returns
AjBool: | ajTrue if the string had a valid unsigned integer value. |
Description
Converts a string into an unsigned integer value.
Uses the strtoul call in the C RTL from C89 onwards.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string into an unsigned long integer value.
Uses the strtoul call in the C RTL.
Synopsis
Prototype
AjBool ajStrToUlong (
const AjPStr str,
ajulong* Pval
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajulong* | Pval | Output | String represented as an integer. |
AjBool | | RETURN | ajTrue if the string had a valid integer value. |
Input
Output
Pval: | (Output) | String represented as an integer. |
Returns
AjBool: | ajTrue if the string had a valid integer value. |
Description
Converts a string into an unsigned long integer value.
Uses the strtoul call in the C RTL.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for converting datatypes to strings.
Functions: ajStrFromBool ajStrFromDouble ajStrFromDoubleExp ajStrFromFloat ajStrFromInt ajStrFromLong ajStrFromUint ajStrFromVoid
Converts a Boolean value into a 1-letter string.
Can be used to print boolean values, but the ajFmt library has better ways.
Synopsis
Prototype
AjBool ajStrFromBool (
AjPStr* Pstr,
AjBool val
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | String to hold the result. |
AjBool | val | Input | Boolean value |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | String to hold the result. |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a Boolean value into a 1-letter string.
Can be used to print boolean values, but the ajFmt library has better ways.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a double precision value into a string.
The string size is set to be just large enough to hold the value.
Synopsis
Prototype
AjBool ajStrFromDouble (
AjPStr* Pstr,
double val,
ajint precision
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
double | val | Input | Double precision value |
ajint | precision | Input | Precision (number of decimal places) to use. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
val: | (Input) | Double precision value |
precision: | (Input) | Precision (number of decimal places) to use. |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a double precision value into a string.
The string size is set to be just large enough to hold the value.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a double precision value into a string.
The string size is set to be just large enough to hold the value. Uses
exponential form.
Synopsis
Prototype
AjBool ajStrFromDoubleExp (
AjPStr* Pstr,
double val,
ajint precision
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
double | val | Input | Double precision value |
ajint | precision | Input | Precision (number of decimal places) to use. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
val: | (Input) | Double precision value |
precision: | (Input) | Precision (number of decimal places) to use. |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a double precision value into a string.
The string size is set to be just large enough to hold the value. Uses
exponential form.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a floating point value into a string.
The string size is set to be just large enough to hold the value.
Synopsis
Prototype
AjBool ajStrFromFloat (
AjPStr* Pstr,
float val,
ajint precision
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
float | val | Input | Floating point value |
ajint | precision | Input | Precision (number of decimal places) to use. |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
val: | (Input) | Floating point value |
precision: | (Input) | Precision (number of decimal places) to use. |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a floating point value into a string.
The string size is set to be just large enough to hold the value.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts an integer value into a string.
The string size is set to be just large enough to hold the value.
Synopsis
Prototype
AjBool ajStrFromInt (
AjPStr* Pstr,
ajint val
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
ajint | val | Input | Integer value |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts an integer value into a string.
The string size is set to be just large enough to hold the value.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts an ajlong integer value into a string.
The string size is set to be just large enough to hold the value.
Synopsis
Prototype
AjBool ajStrFromLong (
AjPStr* Pstr,
ajlong val
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
ajlong | val | Input | Long integer value |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
val: | (Input) | Long integer value |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts an ajlong integer value into a string.
The string size is set to be just large enough to hold the value.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts an unsigned integer value into a string.
The string size is set to be just large enough to hold the value.
Synopsis
Prototype
AjBool ajStrFromUint (
AjPStr* Pstr,
ajuint val
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
ajuint | val | Input | Integer value |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts an unsigned integer value into a string.
The string size is set to be just large enough to hold the value.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests a void pointer and if it is potentially an ASCII string
saves it as the output string.
The string size is set to be just large enough to hold the value.
Intended to allow possible strings to be reported in tables and lists
where they must be held as void* pointers
Synopsis
Prototype
AjBool ajStrFromVoid (
AjPStr* Pstr,
const void* vval
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Output | Target string |
const void* | vval | Input | Integer value |
AjBool | | RETURN | ajTrue if string was found |
Input
vval: | (Input) | Integer value |
Output
Pstr: | (Output) | Target string |
Returns
AjBool: | ajTrue if string was found |
Description
Tests a void pointer and if it is potentially an ASCII string
saves it as the output string.
The string size is set to be just large enough to hold the value.
Intended to allow possible strings to be reported in tables and lists
where they must be held as void* pointers
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for formatting strings.
Functions: ajStrFmtBlock ajStrFmtLower ajStrFmtLowerSub ajStrFmtPercentDecode ajStrFmtPercentEncodeC ajStrFmtPercentEncodeS ajStrFmtQuery ajStrFmtQuote ajStrFmtTitle ajStrFmtUpper ajStrFmtUpperSub ajStrFmtWord ajStrFmtWrap ajStrFmtWrapAt ajStrFmtWrapLeft
Splits a string into words (blocks) of a given size by inserting spaces.
Mainly intended for sequence output formats
Synopsis
Prototype
AjBool ajStrFmtBlock (
AjPStr* Pstr,
ajulong len
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String. |
ajulong | len | Input | Block size |
AjBool | | RETURN | ajTrue on success |
Input
Input & Output
Returns
Description
Splits a string into words (blocks) of a given size by inserting spaces.
Mainly intended for sequence output formats
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string to lower case.
If the string has multiple references, a new string is made first.
Synopsis
Prototype
AjBool ajStrFmtLower (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a string to lower case.
If the string has multiple references, a new string is made first.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a substring of a string to lower case.
Synopsis
Prototype
AjBool ajStrFmtLowerSub (
AjPStr* Pstr,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
ajlong | pos1 | Input | start position for conversion |
ajlong | pos2 | Input | end position for conversion |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
pos1: | (Input) | start position for conversion |
pos2: | (Input) | end position for conversion |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a substring of a string to lower case.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts percent-encoded characters
Synopsis
Prototype
AjBool ajStrFmtPercentDecode (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
AjBool | | RETURN | True if string is not empty. |
Input & Output
Returns
AjBool: | True if string is not empty. |
Description
Converts percent-encoded characters
See Also
See other functions in this section
Availability
In release 6.4.0
Percent-encoded specified characters
Synopsis
Prototype
AjBool ajStrFmtPercentEncodeC (
AjPStr* Pstr,
const char* txt
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
const char* | txt | Input | Characters to encode |
AjBool | | RETURN | True if string is not empty. |
Input
txt: | (Input) | Characters to encode |
Input & Output
Returns
AjBool: | True if string is not empty. |
Description
Percent-encoded specified characters
See Also
See other functions in this section
Availability
In release 6.4.0
Percent-encoded specified characters
Synopsis
Prototype
AjBool ajStrFmtPercentEncodeS (
AjPStr* Pstr,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
const AjPStr | str | Input | Characters to encode |
AjBool | | RETURN | True if string is not empty. |
Input
str: | (Input) | Characters to encode |
Input & Output
Returns
AjBool: | True if string is not empty. |
Description
Percent-encoded specified characters
See Also
See other functions in this section
Availability
In release 6.4.0
Ensures a string is a standard EMBOSS query term with all
alphabetic characters in lower case, and any non alphanumeric characters
replaced by an underscore
Synopsis
Prototype
AjBool ajStrFmtQuery (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
AjBool | | RETURN | True if string is not empty. |
Input & Output
Returns
AjBool: | True if string is not empty. |
Description
Ensures a string is a standard EMBOSS query term with all
alphabetic characters in lower case, and any non alphanumeric characters
replaced by an underscore
See Also
See other functions in this section
Availability
In release 6.4.0
Ensures a string is quoted with double quotes.
Synopsis
Prototype
AjBool ajStrFmtQuote (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | string |
AjBool | | RETURN | True if string is not empty.
As it is at least quoted, it will always return true. |
Input & Output
Returns
AjBool: | True if string is not empty.
As it is at least quoted, it will always return true. |
Description
Ensures a string is quoted with double quotes.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts the first character of a string to upper case.
Synopsis
Prototype
AjBool ajStrFmtTitle (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts the first character of a string to upper case.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string to upper case.
If the string has multiple references, a new string is made first.
Synopsis
Prototype
AjBool ajStrFmtUpper (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue if string was reallocated |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a string to upper case.
If the string has multiple references, a new string is made first.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a substring of a string to upper case.
Synopsis
Prototype
AjBool ajStrFmtUpperSub (
AjPStr* Pstr,
ajlong pos1,
ajlong pos2
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
ajlong | pos1 | Input | start position for conversion |
ajlong | pos2 | Input | end position for conversion |
AjBool | | RETURN | ajTrue if string was reallocated |
Input
pos1: | (Input) | start position for conversion |
pos2: | (Input) | end position for conversion |
Input & Output
Returns
AjBool: | ajTrue if string was reallocated |
Description
Converts a substring of a string to upper case.
See Also
See other functions in this section
Availability
In release 6.4.0
Converts a string to a single word. Spaces are converted to underscores.
Leading substrings ending in a colon are removed.
Synopsis
Prototype
AjBool ajStrFmtWord (
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | String |
AjBool | | RETURN | ajTrue on success |
Input & Output
Returns
Description
Converts a string to a single word. Spaces are converted to underscores.
Leading substrings ending in a colon are removed.
See Also
See other functions in this section
Availability
In release 6.4.0
Formats a string so that it wraps when printed.
Newline characters are inserted, at white space if possible,
with a break at whitespace following the preferred character
if found, or at the last whitespace, or just at the line width if there
is no whitespace found (it does happen with long hyphenated enzyme names)
Synopsis
Prototype
AjBool ajStrFmtWrap (
AjPStr* Pstr,
ajuint width
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajuint | width | Input | Line width |
AjBool | | RETURN | ajTrue on successful completion else ajFalse; |
Input
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue on successful completion else ajFalse; |
Description
Formats a string so that it wraps when printed.
Newline characters are inserted, at white space if possible,
with a break at whitespace following the preferred character
if found, or at the last whitespace, or just at the line width if there
is no whitespace found (it does happen with long hyphenated enzyme names)
See Also
See other functions in this section
Availability
In release 6.4.0
Formats a string so that it wraps when printed.
Breaks are at a preferred character (for example ',' for author lists)
Newline characters are inserted, at white space if possible,
with a break at whitespace following the preferred character
if found, or at the last whitespace, or just at the line width if there
is no whitespace found (it does happen with long hyphenated enzyme names)
Synopsis
Prototype
AjBool ajStrFmtWrapAt (
AjPStr* Pstr,
ajuint width,
char ch
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajuint | width | Input | Line width |
char | ch | Input | Preferred last character on line |
AjBool | | RETURN | ajTrue on successful completion else ajFalse; |
Input
width: | (Input) | Line width |
ch: | (Input) | Preferred last character on line |
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue on successful completion else ajFalse; |
Description
Formats a string so that it wraps when printed.
Breaks are at a preferred character (for example ',' for author lists)
Newline characters are inserted, at white space if possible,
with a break at whitespace following the preferred character
if found, or at the last whitespace, or just at the line width if there
is no whitespace found (it does happen with long hyphenated enzyme names)
See Also
See other functions in this section
Availability
In release 6.4.0
Formats a string so that it wraps and has a margin of space characters
and an additional indent when printed.
Newline characters are inserted, at white space if possible,
Synopsis
Prototype
AjBool ajStrFmtWrapLeft (
AjPStr* Pstr,
ajuint width,
ajuint margin,
ajuint indent
);
Type | Name | Read/Write | Description |
AjPStr* | Pstr | Modify | Target string |
ajuint | width | Input | Line width |
ajuint | margin | Input | Left margin |
ajuint | indent | Input | Left indentation on later lines |
AjBool | | RETURN | ajTrue on successful completion else ajFalse; |
Input
width: | (Input) | Line width |
margin: | (Input) | Left margin |
indent: | (Input) | Left indentation on later lines |
Input & Output
Pstr: | (Modify) | Target string |
Returns
AjBool: | ajTrue on successful completion else ajFalse; |
Description
Formats a string so that it wraps and has a margin of space characters
and an additional indent when printed.
Newline characters are inserted, at white space if possible,
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for comparing strings
Functions: ajStrMatchC ajStrMatchS ajStrMatchCaseC ajStrMatchCaseS ajStrMatchWildC ajStrMatchWildS ajStrMatchWildCaseC ajStrMatchWildCaseS ajStrMatchWildWordC ajStrMatchWildWordS ajStrMatchWildWordCaseC ajStrMatchWildWordCaseS ajStrMatchWordAllS ajStrMatchWordOneS ajStrPrefixC ajStrPrefixS ajStrPrefixCaseC ajStrPrefixCaseS ajStrSuffixC ajStrSuffixS ajStrSuffixCaseC ajStrSuffixCaseS
Simple test for matching a string and a text string.
Synopsis
Prototype
AjBool ajStrMatchC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if two complete strings are the same |
Input
str: | (Input) | String |
txt2: | (Input) | Text |
Returns
AjBool: | ajTrue if two complete strings are the same |
Description
Simple test for matching a string and a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple test for matching two strings.
Synopsis
Prototype
AjBool ajStrMatchS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Second String |
AjBool | | RETURN | ajTrue if two complete strings are the same |
Input
str: | (Input) | String |
str2: | (Input) | Second String |
Returns
AjBool: | ajTrue if two complete strings are the same |
Description
Simple test for matching two strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching a string and a text string.
Synopsis
Prototype
AjBool ajStrMatchCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if two strings are exactly the same excluding case |
Input
str: | (Input) | String |
txt2: | (Input) | Text |
Returns
AjBool: | ajTrue if two strings are exactly the same excluding case |
Description
Simple case-insensitive test for matching a string and a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching two strings.
Synopsis
Prototype
AjBool ajStrMatchCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Second String |
AjBool | | RETURN | ajTrue if two strings are exactly the same excluding case |
Input
str: | (Input) | String |
str2: | (Input) | Second String |
Returns
AjBool: | ajTrue if two strings are exactly the same excluding case |
Description
Simple case-insensitive test for matching two strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-sensitive test for matching a string and a text string using
wildcard characters.
Synopsis
Prototype
AjBool ajStrMatchWildC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Wildcard text |
AjBool | | RETURN | ajTrue if the strings match |
Input
str: | (Input) | String |
txt2: | (Input) | Wildcard text |
Returns
AjBool: | ajTrue if the strings match |
Description
Simple case-sensitive test for matching a string and a text string using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-sensitive test for matching two strings using wildcard
characters.
Synopsis
Prototype
AjBool ajStrMatchWildS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Wildcard string |
AjBool | | RETURN | ajTrue if two strings match |
Input
str: | (Input) | String |
str2: | (Input) | Wildcard string |
Returns
AjBool: | ajTrue if two strings match |
Description
Simple case-sensitive test for matching two strings using wildcard
characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching a string and a text string using
wildcard characters.
Synopsis
Prototype
AjBool ajStrMatchWildCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Wildcard text |
AjBool | | RETURN | ajTrue if the strings match |
Input
str: | (Input) | String |
txt2: | (Input) | Wildcard text |
Returns
AjBool: | ajTrue if the strings match |
Description
Simple case-insensitive test for matching a string and a text string using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Simple case-insensitive test for matching two strings using wildcard
characters.
Synopsis
Prototype
AjBool ajStrMatchWildCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Wildcard string |
AjBool | | RETURN | ajTrue if two strings match |
Input
str: | (Input) | String |
str2: | (Input) | Wildcard string |
Returns
AjBool: | ajTrue if two strings match |
Description
Simple case-insensitive test for matching two strings using wildcard
characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-sensitive test for matching a text string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
Synopsis
Prototype
AjBool ajStrMatchWildWordC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
str: | (Input) | String |
txt2: | (Input) | Text |
Returns
Description
Case-sensitive test for matching a text string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-sensitive test for matching a string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
Synopsis
Prototype
AjBool ajStrMatchWildWordS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
str: | (Input) | String |
str2: | (Input) | Text |
Returns
Description
Case-sensitive test for matching a string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching a text string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
Synopsis
Prototype
AjBool ajStrMatchWildWordCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
str: | (Input) | String |
txt2: | (Input) | Text |
Returns
Description
Case-insensitive test for matching a text string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching a string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
Synopsis
Prototype
AjBool ajStrMatchWildWordCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
str: | (Input) | String |
str2: | (Input) | Text |
Returns
Description
Case-insensitive test for matching a string "word" against a string
using wildcard characters.
'Word' is defined as starting and ending with an alphanumeric character
(A-Z a-z 0-9) with no white space.
The query text can use '*' or '?' as a wildcard.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching all words within a string.
Matches can be to parts of words in the original string.
'Word' is defined as no white space.
Synopsis
Prototype
AjBool ajStrMatchWordAllS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
str: | (Input) | String |
str2: | (Input) | Text |
Returns
Description
Test for matching all words within a string.
Matches can be to parts of words in the original string.
'Word' is defined as no white space.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching a word within a string.
Matches can be to parts of words in the original string.
'Word' is defined as no white space.
Synopsis
Prototype
AjBool ajStrMatchWordOneS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Text |
AjBool | | RETURN | ajTrue if found |
Input
str: | (Input) | String |
str2: | (Input) | Text |
Returns
Description
Test for matching a word within a string.
Matches can be to parts of words in the original string.
'Word' is defined as no white space.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the start of a string against a given prefix text string.
Synopsis
Prototype
AjBool ajStrPrefixC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Prefix as text |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
str: | (Input) | String |
txt2: | (Input) | Prefix as text |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Test for matching the start of a string against a given prefix text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the start of a string against a given prefix string.
Synopsis
Prototype
AjBool ajStrPrefixS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Prefix |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
str: | (Input) | String |
str2: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Test for matching the start of a string against a given prefix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the start of a string against a
given prefix text string.
Synopsis
Prototype
AjBool ajStrPrefixCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Prefix |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
str: | (Input) | String |
txt2: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Case-insensitive test for matching the start of a string against a
given prefix text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the start of a string against a
given prefix string.
Synopsis
Prototype
AjBool ajStrPrefixCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Prefix |
AjBool | | RETURN | ajTrue if the string begins with the prefix |
Input
str: | (Input) | String |
str2: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string begins with the prefix |
Description
Case-insensitive test for matching the start of a string against a
given prefix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the end of a string against a given suffix text string.
Synopsis
Prototype
AjBool ajStrSuffixC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Suffix as text |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
str: | (Input) | String |
txt2: | (Input) | Suffix as text |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Test for matching the end of a string against a given suffix text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Test for matching the end of a string against a given suffix string.
Synopsis
Prototype
AjBool ajStrSuffixS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Suffix |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
str: | (Input) | String |
str2: | (Input) | Suffix |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Test for matching the end of a string against a given suffix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the end of a string against a
given suffix text string.
Synopsis
Prototype
AjBool ajStrSuffixCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Prefix |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
str: | (Input) | String |
txt2: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Case-insensitive test for matching the end of a string against a
given suffix text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Case-insensitive test for matching the end of a string against a
given suffix string.
Synopsis
Prototype
AjBool ajStrSuffixCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Prefix |
AjBool | | RETURN | ajTrue if the string ends with the suffix |
Input
str: | (Input) | String |
str2: | (Input) | Prefix |
Returns
AjBool: | ajTrue if the string ends with the suffix |
Description
Case-insensitive test for matching the end of a string against a
given suffix string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for sorting strings.
Functions: MAJSTRCMPC ajStrCmpC ajStrCmpLenC MAJSTRCMPS ajStrCmpS ajStrCmpCaseS ajStrCmpLenS ajStrCmpWildC ajStrCmpWildS ajStrCmpWildCaseC ajStrCmpWildCaseS ajStrVcmp
Finds the sort order of a string and a text string.
A macro version of {ajStrCmpC} in case it is needed for speed
Input
str: | (Input) | String object |
txt2: | (Input) | Text string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of a string and a text string.
A macro version of {ajStrCmpC} in case it is needed for speed
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of a string and a text string.
Synopsis
Prototype
int ajStrCmpC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String object |
const char* | txt2 | Input | Text string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String object |
txt2: | (Input) | Text string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of a string and a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of a string and a text string comparing the first
n characters only.
Synopsis
Prototype
int ajStrCmpLenC (
const AjPStr str,
const char* txt2,
size_t len
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String object |
const char* | txt2 | Input | Text string |
size_t | len | Input | Length to compare |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String object |
txt2: | (Input) | Text string |
len: | (Input) | Length to compare |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of a string and a text string comparing the first
n characters only.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of two strings.
A macro version of {ajStrCmpS} in case it is needed for speed
Input
str: | (Input) | First string |
str2: | (Input) | Second string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of two strings.
A macro version of {ajStrCmpS} in case it is needed for speed
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of two strings.
Synopsis
Prototype
int ajStrCmpS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | First string |
const AjPStr | str2 | Input | Second string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | First string |
str2: | (Input) | Second string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of two strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of two strings using a case-insensitive comparison.
Synopsis
Prototype
int ajStrCmpCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | text string |
const AjPStr | str2 | Input | Text string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | text string |
str2: | (Input) | Text string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of two strings using a case-insensitive comparison.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of two strings comparing the first
n characters only.
Compares the first n characters of two strings
Synopsis
Prototype
int ajStrCmpLenS (
const AjPStr str,
const AjPStr str2,
size_t len
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String object |
const AjPStr | str2 | Input | Second string object |
size_t | len | Input | Length to compare |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String object |
str2: | (Input) | Second string object |
len: | (Input) | Length to compare |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of two strings comparing the first
n characters only.
Compares the first n characters of two strings
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort-order (case insensitive) of string and a text string using
wildcard characters.
Synopsis
Prototype
int ajStrCmpWildC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Wildcard text |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String |
txt2: | (Input) | Wildcard text |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort-order (case insensitive) of string and a text string using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort-order (case insensitive) of two strings using wildcard
characters.
Synopsis
Prototype
int ajStrCmpWildS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Wildcard string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String |
str2: | (Input) | Wildcard string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort-order (case insensitive) of two strings using wildcard
characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort-order (case sensitive) of string and a text string using
wildcard characters.
Synopsis
Prototype
int ajStrCmpWildCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | Wildcard text |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String |
txt2: | (Input) | Wildcard text |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort-order (case sensitive) of string and a text string using
wildcard characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort-order (case sensitive) of two strings using wildcard
characters.
Synopsis
Prototype
int ajStrCmpWildCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | Wildcard string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | String |
str2: | (Input) | Wildcard string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort-order (case sensitive) of two strings using wildcard
characters.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the sort order of two strings cast as void.
For use with {ajListSort}, {ajListUnique} and other functions which
require a general function with void arguments.
Synopsis
Prototype
int ajStrVcmp (
const void* str,
const void* str2
);
Type | Name | Read/Write | Description |
const void* | str | Input | First string |
const void* | str2 | Input | Second string |
int | | RETURN | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Input
str: | (Input) | First string |
str2: | (Input) | Second string |
Returns
int: | -1 if first string should sort before second, +1 if the
second string should sort first. 0 if they are identical
in length and content. |
Description
Finds the sort order of two strings cast as void.
For use with {ajListSort}, {ajListUnique} and other functions which
require a general function with void arguments.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for finding substrings or characters in strings.
Functions: ajStrFindC ajStrFindS ajStrFindAnyC ajStrFindAnyK ajStrFindAnyS ajStrFindCaseC ajStrFindCaseS ajStrFindNextC ajStrFindNextK ajStrFindNextS ajStrFindRestC ajStrFindRestS ajStrFindRestCaseC ajStrFindRestCaseS ajStrFindlastC ajStrFindlastK ajStrFindlastS
Finds the first occurrence in a string of a second (text) string.
Synopsis
Prototype
ajlong ajStrFindC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
txt2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of a second (text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of a second string.
Synopsis
Prototype
ajlong ajStrFindS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
str2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of a second string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of any character in a second
(text) string.
Synopsis
Prototype
ajlong ajStrFindAnyC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
txt2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of any character in a second
(text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of a specified character.
Synopsis
Prototype
ajlong ajStrFindAnyK (
const AjPStr str,
char chr
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
char | chr | Input | character to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
chr: | (Input) | character to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of a specified character.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of any character in a second
string.
Synopsis
Prototype
ajlong ajStrFindAnyS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
str2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of any character in a second
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of a second (text) string using a
case-insensitive search.
Synopsis
Prototype
ajlong ajStrFindCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found. |
Input
str: | (Input) | String |
txt2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found. |
Description
Finds the first occurrence in a string of a second (text) string using a
case-insensitive search.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of a second string using a
case-insensitive search.
Synopsis
Prototype
ajlong ajStrFindCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
-1 if not found. |
Input
str: | (Input) | String |
str2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
-1 if not found. |
Description
Finds the first occurrence in a string of a second string using a
case-insensitive search.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the next occurrence in a string of a second
(text) string.
Synopsis
Prototype
ajlong ajStrFindNextC (
const AjPStr str,
ajlong pos1,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajlong | pos1 | Input | Start position in string |
const char* | txt2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
pos1: | (Input) | Start position in string |
txt2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the next occurrence in a string of a second
(text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the next occurrence in a string of a specified character.
Synopsis
Prototype
ajlong ajStrFindNextK (
const AjPStr str,
ajlong pos1,
char chr
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajlong | pos1 | Input | Start position in string |
char | chr | Input | character to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
pos1: | (Input) | Start position in string |
chr: | (Input) | character to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the next occurrence in a string of a specified character.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the next occurrence in a string of any character in a second
string.
Synopsis
Prototype
ajlong ajStrFindNextS (
const AjPStr str,
ajlong pos1,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
ajlong | pos1 | Input | Start position in string |
const AjPStr | str2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
pos1: | (Input) | Start position in string |
str2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the next occurrence in a string of any character in a second
string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of any character not in a second
(text) string.
Synopsis
Prototype
ajlong ajStrFindRestC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
txt2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of any character not in a second
(text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of any character not in a second
(text) string.
Synopsis
Prototype
ajlong ajStrFindRestS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
str2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of any character not in a second
(text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of any character not in a second
(text) string (case-insensitive).
Synopsis
Prototype
ajlong ajStrFindRestCaseC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | txt2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
txt2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of any character not in a second
(text) string (case-insensitive).
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the first occurrence in a string of any character not in a second
(text) string (case-insensitive).
Synopsis
Prototype
ajlong ajStrFindRestCaseS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | str2 | Input | text to find |
ajlong | | RETURN | Position of the start of text in string if found.
Or -1 for text not found. |
Input
str: | (Input) | String |
str2: | (Input) | text to find |
Returns
ajlong: | Position of the start of text in string if found.
Or -1 for text not found. |
Description
Finds the first occurrence in a string of any character not in a second
(text) string (case-insensitive).
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the last occurrence in a string of a second (text) string.
Synopsis
Prototype
ajlong ajStrFindlastC (
const AjPStr str,
const char* txt2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to search |
const char* | txt2 | Input | text to look for |
ajlong | | RETURN | Position of the text string if found. |
Input
str: | (Input) | String to search |
txt2: | (Input) | text to look for |
Returns
ajlong: | Position of the text string if found. |
Description
Finds the last occurrence in a string of a second (text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the last occurrence in a string of a character.
Synopsis
Prototype
ajlong ajStrFindlastK (
const AjPStr str,
char chr
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to search |
char | chr | Input | Character to look for |
ajlong | | RETURN | Position of the character if found. |
Input
str: | (Input) | String to search |
chr: | (Input) | Character to look for |
Returns
ajlong: | Position of the character if found. |
Description
Finds the last occurrence in a string of a character.
See Also
See other functions in this section
Availability
In release 6.4.0
Finds the last occurrence in a string of a second (text) string.
Synopsis
Prototype
ajlong ajStrFindlastS (
const AjPStr str,
const AjPStr str2
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to search |
const AjPStr | str2 | Input | text to look for |
ajlong | | RETURN | Position of the text string if found. |
Input
str: | (Input) | String to search |
str2: | (Input) | text to look for |
Returns
ajlong: | Position of the text string if found. |
Description
Finds the last occurrence in a string of a second (text) string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for parsing tokens from strings.
Functions: ajStrExtractFirst ajStrExtractToken ajStrExtractWord ajStrParseC ajStrParseCount ajStrParseCountC ajStrParseCountS ajStrParseCountMultiC ajStrParseSplit ajStrParseWhite
Returns a word from the start of a string, and the remainder of the string
Synopsis
Prototype
AjBool ajStrExtractFirst (
const AjPStr str,
AjPStr* Prest,
AjPStr* Pword
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to be parsed |
AjPStr* | Prest | Output | Remainder of string |
AjPStr* | Pword | Output | First word of string |
AjBool | | RETURN | True if parsing succeeded |
Input
str: | (Input) | String to be parsed |
Output
Prest: | (Output) | Remainder of string |
Pword: | (Output) | First word of string |
Returns
AjBool: | True if parsing succeeded |
Description
Returns a word from the start of a string, and the remainder of the string
See Also
See other functions in this section
Availability
In release 6.4.0
Returns a word from the start of a string, and the remainder of the string.
Leading spaces and punctuation (commas, semicolons) are ignored
Synopsis
Prototype
AjBool ajStrExtractToken (
const AjPStr str,
AjPStr* Prest,
AjPStr* Pword
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to be parsed |
AjPStr* | Prest | Output | Remainder of string |
AjPStr* | Pword | Output | First token of string |
AjBool | | RETURN | True if parsing succeeded |
Input
str: | (Input) | String to be parsed |
Output
Prest: | (Output) | Remainder of string |
Pword: | (Output) | First token of string |
Returns
AjBool: | True if parsing succeeded |
Description
Returns a word from the start of a string, and the remainder of the string.
Leading spaces and punctuation (commas, semicolons) are ignored
See Also
See other functions in this section
Availability
In release 6.4.0
Returns a word from the start of a string, and the remainder of the string.
Leading spaces are skipped.
Synopsis
Prototype
AjBool ajStrExtractWord (
const AjPStr str,
AjPStr* Prest,
AjPStr* Pword
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to be parsed |
AjPStr* | Prest | Output | Remainder of string |
AjPStr* | Pword | Output | First word of string |
AjBool | | RETURN | True if parsing succeeded |
Input
str: | (Input) | String to be parsed |
Output
Prest: | (Output) | Remainder of string |
Pword: | (Output) | First word of string |
Returns
AjBool: | True if parsing succeeded |
Description
Returns a word from the start of a string, and the remainder of the string.
Leading spaces are skipped.
See Also
See other functions in this section
Availability
In release 6.4.0
Tokenise a string using a specified set of delimiters and return tokens
from the string.
This function uses the C run time library strtok function. This makes it
necessary to only call it from one string at a time as strtok and this
function have internal memories of the last position.
Synopsis
Prototype
const AjPStr ajStrParseC (
const AjPStr str,
const char* txtdelim
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to be parsed (first call) or
NULL for follow-up calls using the same string, as for the
C RTL function strtok which is eventually called. |
const char* | txtdelim | Input | Delimiter(s) to be used between tokens. |
const AjPStr | | RETURN | Token returned, when all tokens are parsed
a NULL is returned. |
Input
str: | (Input) | String to be parsed (first call) or
NULL for follow-up calls using the same string, as for the
C RTL function strtok which is eventually called. |
txtdelim: | (Input) | Delimiter(s) to be used between tokens. |
Returns
const AjPStr: | Token returned, when all tokens are parsed
a NULL is returned. |
Description
Tokenise a string using a specified set of delimiters and return tokens
from the string.
This function uses the C run time library strtok function. This makes it
necessary to only call it from one string at a time as strtok and this
function have internal memories of the last position.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the number of tokens in a string, delimited by whitespace
Synopsis
Prototype
ajuint ajStrParseCount (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to examine. |
ajuint | | RETURN | The number of tokens |
Input
str: | (Input) | String to examine. |
Returns
ajuint: | The number of tokens |
Description
Returns the number of tokens in a string, delimited by whitespace
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the number of tokens in a string using a specified set of
delimiters held in a text string.
Synopsis
Prototype
ajuint ajStrParseCountC (
const AjPStr str,
const char* txtdelim
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to examine. |
const char* | txtdelim | Input | String of delimiter characters. |
ajuint | | RETURN | The number of tokens |
Input
str: | (Input) | String to examine. |
txtdelim: | (Input) | String of delimiter characters. |
Returns
ajuint: | The number of tokens |
Description
Returns the number of tokens in a string using a specified set of
delimiters held in a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the number of tokens in a string using a specified set of
delimiters held in a string.
Synopsis
Prototype
ajuint ajStrParseCountS (
const AjPStr str,
const AjPStr strdelim
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to examine. |
const AjPStr | strdelim | Input | String of delimiter characters. |
ajuint | | RETURN | The number of tokens |
Input
str: | (Input) | String to examine. |
strdelim: | (Input) | String of delimiter characters. |
Returns
ajuint: | The number of tokens |
Description
Returns the number of tokens in a string using a specified set of
delimiters held in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the number of tokens in a string.
Uses reentrant {ajSysStrtokR} in place of the C RTL strtok function.
Synopsis
Prototype
ajuint ajStrParseCountMultiC (
const AjPStr str,
const char* txtdelim
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to examine. |
const char* | txtdelim | Input | String of delimiter characters. |
ajuint | | RETURN | The number of tokens |
Input
str: | (Input) | String to examine. |
txtdelim: | (Input) | String of delimiter characters. |
Returns
ajuint: | The number of tokens |
Description
Returns the number of tokens in a string.
Uses reentrant {ajSysStrtokR} in place of the C RTL strtok function.
See Also
See other functions in this section
Availability
In release 6.4.0
Splits a newline-separated multi-line string into an array of strings.
Synopsis
Prototype
ajuint ajStrParseSplit (
const AjPStr str,
AjPStr** PPstr
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
AjPStr** | PPstr | Output | pointer to array of AjPStrs |
ajuint | | RETURN | Number of array elements created |
Input
Output
PPstr: | (Output) | pointer to array of AjPStrs |
Returns
ajuint: | Number of array elements created |
Description
Splits a newline-separated multi-line string into an array of strings.
See Also
See other functions in this section
Availability
In release 6.4.0
Tokenise a string using whitespace and return tokens from the string.
Synopsis
Prototype
const AjPStr ajStrParseWhite (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String to be parsed (first call) or
NULL for follow-up calls using the same string, as for the
C RTL function strtok which is eventually called. |
const AjPStr | | RETURN | Token |
Input
str: | (Input) | String to be parsed (first call) or
NULL for follow-up calls using the same string, as for the
C RTL function strtok which is eventually called. |
Returns
Description
Tokenise a string using whitespace and return tokens from the string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions for reporting of a string object.
Functions: ajStrProbe ajStrStat ajStrTrace ajStrTraceFull ajStrTraceTitle
Default string memory probe which checks the string object and the
string it contains are valid memory
If the given string is NULL, or a NULL pointer, simply returns.
Synopsis
Prototype
void ajStrProbe (
AjPStr const* Pstr
);
Type | Name | Read/Write | Description |
AjPStr const* | Pstr | Input | Pointer to the string to be probed. |
void | | RETURN | |
Input
Pstr: | (Input) | Pointer to the string to be probed. |
Returns
Description
Default string memory probe which checks the string object and the
string it contains are valid memory
If the given string is NULL, or a NULL pointer, simply returns.
See Also
See other functions in this section
Availability
In release 6.4.0
Prints a summary of string usage with debug calls.
Synopsis
Prototype
void ajStrStat (
const char* title
);
Type | Name | Read/Write | Description |
const char* | title | Input | Title for this summary |
void | | RETURN | |
Input
title: | (Input) | Title for this summary |
Returns
Description
Prints a summary of string usage with debug calls.
See Also
See other functions in this section
Availability
In release 6.4.0
Checks a string object for consistency and reports its contents.
Synopsis
Prototype
void ajStrTrace (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
void | | RETURN | |
Input
Returns
Description
Checks a string object for consistency and reports its contents.
See Also
See other functions in this section
Availability
In release 6.4.0
Checks a string object for consistency and reports its contents character
by character.
Synopsis
Prototype
void ajStrTraceFull (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
void | | RETURN | |
Input
Returns
Description
Checks a string object for consistency and reports its contents character
by character.
See Also
See other functions in this section
Availability
In release 6.4.0
Checks a string object for consistency and reports its contents using a
defined title for the report.
Synopsis
Prototype
void ajStrTraceTitle (
const AjPStr str,
const char* title
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const char* | title | Input | Report title |
void | | RETURN | |
Input
str: | (Input) | String |
title: | (Input) | Report title |
Returns
Description
Checks a string object for consistency and reports its contents using a
defined title for the report.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions called on exit from the program by ajExit to do
any necessary cleanup and to report internal statistics to the debug file
Functions: ajStrExit
Prints a summary of string usage with debug calls.
Synopsis
Prototype
void ajStrExit (
void
);
Type | Name | Read/Write | Description |
void | | RETURN | |
Returns
Description
Prints a summary of string usage with debug calls.
See Also
See other functions in this section
Availability
In release 6.4.0
String constant
Sections: string constant constructors
Functions for constructing string constant objects
Functions: ajStrConstS ajStrConstEmpty
Returns an unmodifiable empty string.
Synopsis
Prototype
const AjPStr ajStrConstS (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | String |
const AjPStr | | RETURN | Pointer to an empty string |
Input
Returns
const AjPStr: | Pointer to an empty string |
Description
Returns an unmodifiable empty string.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns an unmodifiable empty string.
Synopsis
Prototype
const AjPStr ajStrConstEmpty (
void
);
Type | Name | Read/Write | Description |
const AjPStr | | RETURN | Pointer to an empty string |
Returns
const AjPStr: | Pointer to an empty string |
Description
Returns an unmodifiable empty string.
See Also
See other functions in this section
Availability
In release 6.4.0
String iterator
Sections: constructors destructors tests resets attributes modifiers stepping
Functions: ajStrIterNew ajStrIterNewBack
String iterator constructor which allocates memory for a string iterator,
used to iterate over the characters in a string.
Synopsis
Prototype
AjIStr ajStrIterNew (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Original string |
AjIStr | | RETURN | String Iterator |
Input
str: | (Input) | Original string |
Returns
Description
String iterator constructor which allocates memory for a string iterator,
used to iterate over the characters in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
String iterator constructor which allocates memory for a string iterator,
used to iterate over the characters in a string, from end to start.
Synopsis
Prototype
AjIStr ajStrIterNewBack (
const AjPStr str
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Original string |
AjIStr | | RETURN | String Iterator |
Input
str: | (Input) | Original string |
Returns
Description
String iterator constructor which allocates memory for a string iterator,
used to iterate over the characters in a string, from end to start.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrIterDel
String iterator destructor which frees memory for a string iterator.
Synopsis
Prototype
void ajStrIterDel (
AjIStr* iter
);
Type | Name | Read/Write | Description |
AjIStr* | iter | Delete | String iterator |
void | | RETURN | |
Output
iter: | (Delete) | String iterator |
Returns
Description
String iterator destructor which frees memory for a string iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrIterDone ajStrIterDoneBack
Tests whether a string iterator has completed yet.
Synopsis
Prototype
AjBool ajStrIterDone (
const AjIStr iter
);
Type | Name | Read/Write | Description |
const AjIStr | iter | Input | String iterator. |
AjBool | | RETURN | true if complete |
Input
iter: | (Input) | String iterator. |
Returns
Description
Tests whether a string iterator has completed yet.
See Also
See other functions in this section
Availability
In release 6.4.0
Tests whether a string iterator (from end to start) has completed yet.
Synopsis
Prototype
AjBool ajStrIterDoneBack (
const AjIStr iter
);
Type | Name | Read/Write | Description |
const AjIStr | iter | Input | String iterator. |
AjBool | | RETURN | true if complete |
Input
iter: | (Input) | String iterator. |
Returns
Description
Tests whether a string iterator (from end to start) has completed yet.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrIterBegin ajStrIterEnd
Sets a string iterator to its start condition,
Synopsis
Prototype
void ajStrIterBegin (
AjIStr iter
);
Type | Name | Read/Write | Description |
AjIStr | iter | Modify | String iterator. |
void | | RETURN | |
Input & Output
iter: | (Modify) | String iterator. |
Returns
Description
Sets a string iterator to its start condition,
See Also
See other functions in this section
Availability
In release 6.4.0
Sets a string iterator to its stop condition.
Synopsis
Prototype
void ajStrIterEnd (
AjIStr iter
);
Type | Name | Read/Write | Description |
AjIStr | iter | Modify | String iterator. |
void | | RETURN | |
Input & Output
iter: | (Modify) | String iterator. |
Returns
Description
Sets a string iterator to its stop condition.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrIterGetC ajStrIterGetK
Returns the remainder of the string at the current string iterator
position.
Synopsis
Prototype
const char* ajStrIterGetC (
const AjIStr iter
);
Type | Name | Read/Write | Description |
const AjIStr | iter | Input | String iterator. |
const char* | | RETURN | Current text string within iterator |
Input
iter: | (Input) | String iterator. |
Returns
const char*: | Current text string within iterator |
Description
Returns the remainder of the string at the current string iterator
position.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the value (character) at the current string iterator position.
Synopsis
Prototype
char ajStrIterGetK (
const AjIStr iter
);
Type | Name | Read/Write | Description |
const AjIStr | iter | Input | String iterator. |
char | | RETURN | Current character within iterator |
Input
iter: | (Input) | String iterator. |
Returns
char: | Current character within iterator |
Description
Returns the value (character) at the current string iterator position.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrIterPutK
Replaces the character at the current string iterator position.
Synopsis
Prototype
void ajStrIterPutK (
AjIStr iter,
char chr
);
Type | Name | Read/Write | Description |
AjIStr | iter | Modify | String iterator. |
char | chr | Input | Character |
void | | RETURN | |
Input
Input & Output
iter: | (Modify) | String iterator. |
Returns
Description
Replaces the character at the current string iterator position.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrIterNext ajStrIterNextBack
Step to next character in string iterator.
Synopsis
Prototype
AjIStr ajStrIterNext (
AjIStr iter
);
Type | Name | Read/Write | Description |
AjIStr | iter | Modify | String iterator. |
AjIStr | | RETURN | Updated iterator duplicated as return value. |
Input & Output
iter: | (Modify) | String iterator. |
Returns
AjIStr: | Updated iterator duplicated as return value. |
Description
Step to next character in string iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
Step to previous character in string iterator.
Synopsis
Prototype
AjIStr ajStrIterNextBack (
AjIStr iter
);
Type | Name | Read/Write | Description |
AjIStr | iter | Modify | String iterator. |
AjIStr | | RETURN | Updated iterator duplicated as return value. |
Input & Output
iter: | (Modify) | String iterator. |
Returns
AjIStr: | Updated iterator duplicated as return value. |
Description
Step to previous character in string iterator.
See Also
See other functions in this section
Availability
In release 6.4.0
String token parser
Sections: constructors destructors assignment reset debugging parsing
Functions: ajStrTokenNewC ajStrTokenNewS ajStrTokenNewcharC ajStrTokenNewcharS
String token parser constructor which allocates memory for a string token
parser object from a string and a set of default delimiters defined in a
text string.
Synopsis
Prototype
AjPStrTok ajStrTokenNewC (
const AjPStr str,
const char* txtdelim
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Source string |
const char* | txtdelim | Input | Default delimiter(s) |
AjPStrTok | | RETURN | A new string token parser. |
Input
str: | (Input) | Source string |
txtdelim: | (Input) | Default delimiter(s) |
Returns
AjPStrTok: | A new string token parser. |
Description
String token parser constructor which allocates memory for a string token
parser object from a string and a set of default delimiters defined in a
text string.
See Also
See other functions in this section
Availability
In release 6.4.0
String token parser constructor which allocates memory for a string token
parser object from a string and an optional set of default delimiters
defined in a text string.
Synopsis
Prototype
AjPStrTok ajStrTokenNewS (
const AjPStr str,
const AjPStr strdelim
);
Type | Name | Read/Write | Description |
const AjPStr | str | Input | Source string |
const AjPStr | strdelim | Input | Default delimiter(s) |
AjPStrTok | | RETURN | A new string token parser. |
Input
str: | (Input) | Source string |
strdelim: | (Input) | Default delimiter(s) |
Returns
AjPStrTok: | A new string token parser. |
Description
String token parser constructor which allocates memory for a string token
parser object from a string and an optional set of default delimiters
defined in a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
String token parser constructor which allocates memory for a string token
parser object from a string and a set of default delimiters defined in a
text string.
Synopsis
Prototype
AjPStrTok ajStrTokenNewcharC (
const char* txt,
const char* txtdelim
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Source string |
const char* | txtdelim | Input | Default delimiter(s) |
AjPStrTok | | RETURN | A new string token parser. |
Input
txt: | (Input) | Source string |
txtdelim: | (Input) | Default delimiter(s) |
Returns
AjPStrTok: | A new string token parser. |
Description
String token parser constructor which allocates memory for a string token
parser object from a string and a set of default delimiters defined in a
text string.
See Also
See other functions in this section
Availability
In release 6.4.0
String token parser constructor which allocates memory for a string token
parser object from a string and an optional set of default delimiters
defined in a text string.
Synopsis
Prototype
AjPStrTok ajStrTokenNewcharS (
const char* txt,
const AjPStr strdelim
);
Type | Name | Read/Write | Description |
const char* | txt | Input | Source string |
const AjPStr | strdelim | Input | Default delimiter(s) |
AjPStrTok | | RETURN | A new string token parser. |
Input
txt: | (Input) | Source string |
strdelim: | (Input) | Default delimiter(s) |
Returns
AjPStrTok: | A new string token parser. |
Description
String token parser constructor which allocates memory for a string token
parser object from a string and an optional set of default delimiters
defined in a text string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrTokenDel
String token parser destructor which frees memory for a string token
parser.
Synopsis
Prototype
void ajStrTokenDel (
AjPStrTok* Ptoken
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Delete | Token parser |
void | | RETURN | |
Output
Ptoken: | (Delete) | Token parser |
Returns
Description
String token parser destructor which frees memory for a string token
parser.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrTokenAssign ajStrTokenAssignC ajStrTokenAssignS
Generates a string token parser object from a string without a specific
set of delimiters.
Synopsis
Prototype
AjBool ajStrTokenAssign (
AjPStrTok* Ptoken,
const AjPStr str
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Output | String token object |
const AjPStr | str | Input | Source string |
AjBool | | RETURN | ajTrue on success. |
Input
Output
Ptoken: | (Output) | String token object |
Returns
AjBool: | ajTrue on success. |
Description
Generates a string token parser object from a string without a specific
set of delimiters.
See Also
See other functions in this section
Availability
In release 6.4.0
Generates a string token parser object from a string and an optional
set of default delimiters defined in a text string.
The string token can be either an existing token to be overwritten
or a NULL.
Synopsis
Prototype
AjBool ajStrTokenAssignC (
AjPStrTok* Ptoken,
const AjPStr str,
const char* txtdelim
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Output | String token object |
const AjPStr | str | Input | Source string |
const char* | txtdelim | Input | Default delimiter(s) |
AjBool | | RETURN | ajTrue on success. |
Input
str: | (Input) | Source string |
txtdelim: | (Input) | Default delimiter(s) |
Output
Ptoken: | (Output) | String token object |
Returns
AjBool: | ajTrue on success. |
Description
Generates a string token parser object from a string and an optional
set of default delimiters defined in a text string.
The string token can be either an existing token to be overwritten
or a NULL.
See Also
See other functions in this section
Availability
In release 6.4.0
Generates a string token parser object from a string and an optional
set of default delimiters defined in a string.
Synopsis
Prototype
AjBool ajStrTokenAssignS (
AjPStrTok* Ptoken,
const AjPStr str,
const AjPStr strdelim
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Output | String token object |
const AjPStr | str | Input | Source string |
const AjPStr | strdelim | Input | Default delimiter(s) |
AjBool | | RETURN | ajTrue on success. |
Input
str: | (Input) | Source string |
strdelim: | (Input) | Default delimiter(s) |
Output
Ptoken: | (Output) | String token object |
Returns
AjBool: | ajTrue on success. |
Description
Generates a string token parser object from a string and an optional
set of default delimiters defined in a string.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrTokenReset
Clears the strings from a string token parser object.
Synopsis
Prototype
void ajStrTokenReset (
AjPStrTok* Ptoken
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Output | String token object |
void | | RETURN | |
Output
Ptoken: | (Output) | String token object |
Returns
Description
Clears the strings from a string token parser object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrTokenTrace
Writes a debug trace of a string token parser object.
Synopsis
Prototype
void ajStrTokenTrace (
const AjPStrTok token
);
Type | Name | Read/Write | Description |
const AjPStrTok | token | Input | String token object |
void | | RETURN | |
Input
token: | (Input) | String token object |
Returns
Description
Writes a debug trace of a string token parser object.
See Also
See other functions in this section
Availability
In release 6.4.0
Functions: ajStrTokenNextFind ajStrTokenNextFindC ajStrTokenNextParse ajStrTokenNextParseC ajStrTokenNextParseS ajStrTokenNextParseDelimiters ajStrTokenNextParseNoskip ajStrTokenRestParse
Parses tokens from a string using a string token parser. Treats the
whole delimiter as a single string between tokens.
Synopsis
Prototype
AjBool ajStrTokenNextFind (
AjPStrTok* Ptoken,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | Token parser. Updated with the delimiter
string (if any) in delim. |
AjPStr* | Pstr | Output | Token found |
AjBool | | RETURN | ajTrue if another token was found. |
Output
Input & Output
Ptoken: | (Modify) | Token parser. Updated with the delimiter
string (if any) in delim. |
Returns
AjBool: | ajTrue if another token was found. |
Description
Parses tokens from a string using a string token parser. Treats the
whole delimiter as a single string between tokens.
See Also
See other functions in this section
Availability
In release 6.4.0
Parses tokens from a string using a string token parser. Treats the
whole delimiter as a single string between tokens.
Synopsis
Prototype
AjBool ajStrTokenNextFindC (
AjPStrTok* Ptoken,
const char* txtdelim,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | Token parser. Updated with the delimiter
string in delim. |
const char* | txtdelim | Input | Delimiter string. |
AjPStr* | Pstr | Output | Token found |
AjBool | | RETURN | ajTrue if another token was found. |
Input
txtdelim: | (Input) | Delimiter string. |
Output
Input & Output
Ptoken: | (Modify) | Token parser. Updated with the delimiter
string in delim. |
Returns
AjBool: | ajTrue if another token was found. |
Description
Parses tokens from a string using a string token parser. Treats the
whole delimiter as a single string between tokens.
See Also
See other functions in this section
Availability
In release 6.4.0
Parses tokens from a string using a string token parser. Uses any
character defined in the string token parsing object delimiter
character set as a delimiter.
The test uses the C function 'strcspn'.
Synopsis
Prototype
AjBool ajStrTokenNextParse (
AjPStrTok* Ptoken,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | String token parsing object. |
AjPStr* | Pstr | Output | Next token returned, may be empty if the
delimiter has changed. |
AjBool | | RETURN | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Output
Pstr: | (Output) | Next token returned, may be empty if the
delimiter has changed. |
Input & Output
Ptoken: | (Modify) | String token parsing object. |
Returns
AjBool: | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Description
Parses tokens from a string using a string token parser. Uses any
character defined in the string token parsing object delimiter
character set as a delimiter.
The test uses the C function 'strcspn'.
See Also
See other functions in this section
Availability
In release 6.4.0
Parses tokens from a string using a string token parser. Uses any
character defined in the delimiter character set as a
delimiter.
Returns the next token parsed from a string token parsing object
Note: This can return "true" but an empty string in cases where the
delimiter has changed since the previous call.
The test uses the C function 'strcspn'.
Synopsis
Prototype
AjBool ajStrTokenNextParseC (
AjPStrTok* Ptoken,
const char* txtdelim,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | String token parsing object. |
const char* | txtdelim | Input | Delimiter character set. |
AjPStr* | Pstr | Output | Next token returned, may be empty if the
delimiter has changed. |
AjBool | | RETURN | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Input
txtdelim: | (Input) | Delimiter character set. |
Output
Pstr: | (Output) | Next token returned, may be empty if the
delimiter has changed. |
Input & Output
Ptoken: | (Modify) | String token parsing object. |
Returns
AjBool: | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Description
Parses tokens from a string using a string token parser. Uses any
character defined in the delimiter character set as a
delimiter.
Returns the next token parsed from a string token parsing object
Note: This can return "true" but an empty string in cases where the
delimiter has changed since the previous call.
The test uses the C function 'strcspn'.
See Also
See other functions in this section
Availability
In release 6.4.0
Parses tokens from a string using a string token parser. Uses any
character defined in the delimiter character set as a
delimiter.
Note: This can return "true" but an empty string in cases where the
delimiter has changed since the previous call.
The test uses the C function 'strcspn'.
Synopsis
Prototype
AjBool ajStrTokenNextParseS (
AjPStrTok* Ptoken,
const AjPStr strdelim,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | String token parsing object. |
const AjPStr | strdelim | Input | Delimiter character set. |
AjPStr* | Pstr | Output | Next token returned, may be empty if the
delimiter has changed. |
AjBool | | RETURN | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Input
strdelim: | (Input) | Delimiter character set. |
Output
Pstr: | (Output) | Next token returned, may be empty if the
delimiter has changed. |
Input & Output
Ptoken: | (Modify) | String token parsing object. |
Returns
AjBool: | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Description
Parses tokens from a string using a string token parser. Uses any
character defined in the delimiter character set as a
delimiter.
Note: This can return "true" but an empty string in cases where the
delimiter has changed since the previous call.
The test uses the C function 'strcspn'.
See Also
See other functions in this section
Availability
In release 6.4.0
Parses tokens from a string using a string token parser. Uses any
character defined in the string token parsing object delimiter
character set as a delimiter.
The test uses the C function 'strcspn'.
Synopsis
Prototype
AjBool ajStrTokenNextParseDelimiters (
AjPStrTok* Ptoken,
AjPStr* Pstr,
AjPStr* Pdelim
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | String token parsing object. |
AjPStr* | Pstr | Output | Next token returned, may be empty if the
delimiter has changed. |
AjPStr* | Pdelim | Output | Delimiter(s) following the token. |
AjBool | | RETURN | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Output
Pstr: | (Output) | Next token returned, may be empty if the
delimiter has changed. |
Pdelim: | (Output) | Delimiter(s) following the token. |
Input & Output
Ptoken: | (Modify) | String token parsing object. |
Returns
AjBool: | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Description
Parses tokens from a string using a string token parser. Uses any
character defined in the string token parsing object delimiter
character set as a delimiter.
The test uses the C function 'strcspn'.
See Also
See other functions in this section
Availability
In release 6.4.0
Parses tokens from a string using a string token parser. Uses any
character defined in the string token parsing object's delimiter
character set as a delimiter.
The test uses the C function 'strcspn'.
Synopsis
Prototype
AjBool ajStrTokenNextParseNoskip (
AjPStrTok* Ptoken,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | String token parsing object. |
AjPStr* | Pstr | Output | Next token returned, may be empty if the
delimiter has changed or if next character
was also a delimiter |
AjBool | | RETURN | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Output
Pstr: | (Output) | Next token returned, may be empty if the
delimiter has changed or if next character
was also a delimiter |
Input & Output
Ptoken: | (Modify) | String token parsing object. |
Returns
AjBool: | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Description
Parses tokens from a string using a string token parser. Uses any
character defined in the string token parsing object's delimiter
character set as a delimiter.
The test uses the C function 'strcspn'.
See Also
See other functions in this section
Availability
In release 6.4.0
Returns the remainder of a string that has been partially parsed using a
string token parser.
Synopsis
Prototype
AjBool ajStrTokenRestParse (
AjPStrTok* Ptoken,
AjPStr* Pstr
);
Type | Name | Read/Write | Description |
AjPStrTok* | Ptoken | Modify | String token parsing object. |
AjPStr* | Pstr | Output | Next token returned. |
AjBool | | RETURN | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Output
Pstr: | (Output) | Next token returned. |
Input & Output
Ptoken: | (Modify) | String token parsing object. |
Returns
AjBool: | True if successfully parsed.
False (and string set to empty) if there is nothing
more to parse. |
Description
Returns the remainder of a string that has been partially parsed using a
string token parser.
See Also
See other functions in this section
Availability
In release 6.4.0