• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
empty string, or: totally clearing the NSTextStorage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

empty string, or: totally clearing the NSTextStorage


  • Subject: empty string, or: totally clearing the NSTextStorage
  • From: Arthur Clemens <email@hidden>
  • Date: Wed, 16 Oct 2002 23:32:02 +0200

I have a peculiar problem: I want to clear my textStorage, but I don't
succeed in clearing it totally - there remains
an empty newline, using this code:
(in my textView)
unsigned length = [[self textStorage] length];
[[self textStorage] replaceCharactersInRange:NSMakeRange(0, length-1)
withString:@""];

When I later use
[[self textStorage] appendAttributedString:someAttributedString];
the first line in my text view is an empty line, so I suspect the
newline is caused by the @"".

When I use replaceCharactersInRange... withString:@"A"
there is no newline and the new attributedString is appended to the A.

I can't use replaceCharactersInRange...withString:nil
because then the textStorage ceases to function.

So how to insert an empty string here, how to insert 'nothing'?

Arthur Clemens
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: empty string, or: totally clearing the NSTextStorage
      • From: Ondra Cada <email@hidden>
    • Re: empty string, or: totally clearing the NSTextStorage
      • From: Andreas Mayer <email@hidden>
    • Re: empty string, or: totally clearing the NSTextStorage
      • From: email@hidden
    • Re: empty string, or: totally clearing the NSTextStorage
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: Declarations near usage (From: tibbetts <email@hidden>)

  • Prev by Date: Re: non-live window resizing
  • Next by Date: Re: Cocoa and PortAudio!
  • Previous by thread: Re: Declarations near usage
  • Next by thread: Re: empty string, or: totally clearing the NSTextStorage
  • Index(es):
    • Date
    • Thread