iPhone SDK: How to manipulate a txtField
<p>Trying to manipulate the contents of a txtField in the textFieldDidEndEditing. What we want to do is rotate the entire contents left and then append the current character at the end.
This is to allow a user to enter a money value without a decimal point.</p>

<p>This is what we have so far but I'm not sure this is the best way to approach this. Nor is this code working as expected.</p>

<p>Any help appreciated.</p>

<pre><code>//easier input for total
if (textField == txtGrandTotal)
{
    //copy contents of total to string2
    NSString *string1 = txtGrandTotal.text;
    NSMutableString *string2;

    //now string2 contains the buffer to manipulate
    string2 = [NSMutableString stringWithString: string1];

    //so, copy it to strMoney2
    strMoney2 = string2;

    int charIndex;
    //for all character in strMoney2, move them rotated left to strMoney1
    for (charIndex = 0; charIndex &lt; [strMoney2 length]; charIndex++)
    {
        NSString *strChar = [strMoney2 substringWithRange: NSMakeRange(charIndex, 1)];
        [strMoney1 insertString:strChar atIndex:charIndex+1];
    }

    //now append the current character to strMoney1
    NSString *strCurrentChar = [string1 substringWithRange: NSMakeRange([string1 length], 1)];      
    [strMoney1 appendString:strCurrentChar];


    //move manipulated string back to txtGrandTotal
    txtGrandTotal.text = strMoney1;
}
</code></pre>
