ajBigStrMid function
Description
Returns the characters from the middle of a Big String text, given a starting position and length.
Syntax
ajBigStrMid(memory_id, start_num, num_chars, [run_condition], [run_by_function_point_only])
Argument Name | Argument Type | Description |
---|---|---|
memory_id (big string ID) (required) | String | The memory address id that keeps the Big String text. A big string ID can be retrieved from ajBigStrSet() or from a big string input parameter. |
start_num (required) | Long | It is the position of the first character you want to extract. |
num_chars (required) | Long | It specifies how many characters to return from Big String text. |
run_condition (optional) | Boolean | The function will run when the value is TRUE. Otherwise will not run. The default value is TRUE. |
run_by_function_point_only (optional) | Boolean | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Preview Function Point. If it equals TRUE, the function can be executed with Preview Function Point (AlchemyJ ribbon \ Preview Function Point) only. The default value is TRUE. |
The function will return:
1) Return Value: Big String
2) Return Type: Single Value
Example
In this example, we will demonstrate how to retrieve a specific number of characters starting from the middle of a Big String. In this example, we would be retrieving the middle letters and starting from the second character from the left which would be 'bcd'.
The Big String value we have used here is 'abcde'. To use the ajBigStrMid formula, firstly we have to convert 'abcde' into a big string ID. This is done using the ajBigstrSet formula.
After converting into a big string ID, we can then use the formula as shown in B9 and it will return a Big String value.
To verify the result, we can use the ajBigStrValue formula in B11 to make it into a normal String. As seen in B12, we have successfully retrieved the middle 3 letters which are 'bcd'.
Error Scenarios
It will return #VALUE! when missing any required parameter or mismatch parameter type. Besides, system will also raise error for below scenario(s).
Error Scenario |
---|
Big String ID does not exist. |
Start num should be greater than zero. |
Num chars should be greater than or equal to zero. |