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,656
  • 11
  • 58
  • 120

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,258
  • 8
  • 52
  • 86