-2

I want to append a string as subscript to another string using Objective C. Does anyone know how can I do this?

Simon Lee
  • 22,304
  • 4
  • 41
  • 45
user1173142
  • 553
  • 2
  • 6
  • 10
  • What does "as subscript" mean? Do you want it to display on the screen as a subscript, or do you want to be in square brackets like an array subscript? – rob mayoff Feb 07 '12 at 08:37
  • 1
    refer http://stackoverflow.com/questions/3525435/is-there-an-easy-way-to-make-part-of-an-nsstring-object-a-superscript-or-subscri – Maulik Feb 07 '12 at 08:39
  • Could you provide example ? As I understand you have "some good string" – Chugaister Feb 07 '12 at 08:47

1 Answers1

2

If you mean suffix, here's how:

NSString *foobar = [@"foo" stringByAppendingString:@"bar"];
Nick Lockwood
  • 40,865
  • 11
  • 112
  • 103
  • Subscript doesn't mean anything in the context of a string. subscript is a typographic effect. You could add a subscript to a label, or to an NSAttributedString, but not to an NSString. – Nick Lockwood Feb 07 '12 at 10:04
  • Subscript is ambiguous. You are assuming one particular meaning (a numeric subscript), but the question doesn't make that clear. He could mean any arbitrary text as a subscript. – Nick Lockwood Feb 07 '12 at 10:32
  • Yeah I can use unicode for each char or number but it would be a very lengthy process, coz for each and every possibility I have to write one condition. – user1173142 Feb 08 '12 at 08:54