Q:

Convert Javascript to Objective C (Last 4 digits of number)

Please bear with me in programming. I'm still pretty new to Objective C. I'd like to convert the following javascript code to Objective C. I want to only show the last 4 digits of the routing and account number.
<script>
var routing = document.getElementById('routing_number');
var changed1 = document.getElementById('routing_number');

changed1.value = new Array(routing.value.length-3).join('x') + routing.value.substr(routing.value.length-4, 4);

var account = document.getElementById('account_number');
var changed2 = document.getElementById('account_number');

changed2.value = new Array(account.value.length-3).join('x') + account.value.substr(account.value.length-4, 4);

</script>

I tried the following partial code in Objective C but it didn't work. In other words, I want exactly what's in the javascript translated into Objective C. Any help is much appreciated.
_routingText.text = [Utilities removeNullFromString:[response valueForKey:@"routing_number"]];
                     NSString *routing_number = _routingText.text;
                    routing_number = [routing_number substringToIndex:(routing_number.length - 4)];

A:

I figured it out for anyone who wants the answer it's below.
NSString *routing_number = [Utilities removeNullFromString:[response valueForKey:@"routing_number"]];
NSString *last4Chr = [routing_number substringFromIndex: [routing_number length] - 4];
NSMutableString *mask = [[NSMutableString alloc]init];

for (int i=0; i<[routing_number length]-4; i++) 
{
   [mask appendString:@"*"];
}
[mask appendString:last4Chr];
_routingText.text = mask;

NSString *account_number = [Utilities removeNullFromString:[response valueForKey:@"account_number"]];
NSString *last4Chr2 = [account_number substringFromIndex: [account_number length] - 4];
NSMutableString *mask2 = [[NSMutableString alloc]init];

for (int i=0; i<[account_number length]-4; i++) 
{
   [mask2 appendString:@"*"];
}
[mask2 appendString:last4Chr2];
_acc_NumText.text = mask2;

