User`s guide
4 Using MWArra y Classes
Example — Getting Character Array Data with getChar
Use getChar to display the string stored in MWCharArray object A:
char[] chArray = {'H', 'e', 'l', 'l', 'o'};
MWCharArray A = new MWCharArray(chArray);
for (int i = 1; i <= 5; i++)
System.out.print(A.getChar(i));
When run, the example displays this output:
Hello
set. T his method replaces the character located at the sp ecified one-based
offset in the
MWCharArray object with the specified char value.
To set the element at a specific index, use one of
public void set(int index, char element);
public void set(int[] index, char element);
Use the first syntax (int index) to return the ele ment at the specified
one-based offset in the a rray, accessing elements in column-wise order. Us e the
second syntax (
int[] index) to return the element at the specified array of
one-based indices. The first syntax offers better performance than the second.
Input Parameters
element
New element to replace at index
index
Index of the requested element in the MWCharArray
In the case where index is of type int, the valid range for index is 1<=index
<= N
,whereN is the total number of elements in the array.
4-114