0

I want to convert the NSString into asterix (*) format depending on the length,So how to do it..

if([str1 lenght])
{
    str2 = "*";
}

Regards Ranjit

Ranjit
  • 4,576
  • 11
  • 62
  • 121

1 Answers1

1

You mean that you want to create a string containing as many asterisks as the length of the original?

NSString *str2 = @"";
str2 = [str2 stringByPaddingToLength:str1.length withString:@"*" startingAtIndex:0];
tarmes
  • 15,366
  • 10
  • 53
  • 87