Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Text & Strings

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa
Mac Cocoa  
Author Message
XNote
Kapetan


Joined: 16 Jun 2006
Posts: 532

PostPosted: Tue Sep 30, 2008 5:01 pm    Post subject: Text & Strings Reply with quote

SO - How to display test using Quartz on the iPhone?

"I've been trying to display text using a Quartz context, but no matter what
I've tried I simply haven't had luck getting the text to display (I'm able to
display all sorts of other Quartz objects though)."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Tue Oct 07, 2008 7:45 pm    Post subject: Reply with quote

SO - How to do string conversions in objective c?

"To really convert from a string to a number properly, you need to use an
instance of NSNumberFormatter configured for the locale from which you're
reading the string."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Tue Oct 14, 2008 5:02 pm    Post subject: Reply with quote

MF - Converting String To Data Without Encoding?

"If you were doing the conversion yourself anyways, you should probably
be using NSUTF8Encoding rather than NSUnicodeEncoding. Otherwise the
XML parser will choke as you see, since the text is 16-bit unicode, but the
XML says it is UTF-8."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Wed Jan 21, 2009 11:02 pm    Post subject: Reply with quote

daringfireball.net - Fonts From Mac OS X Included With iPhone

* Full font family included
* Partial font family included
* Not included, but name is special-cased
* Not included
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Wed Mar 04, 2009 1:44 am    Post subject: Reply with quote

cocoadev.com - UsingCustomFontsInYourCocoaApplications

(Cocoa, Carbon, whatever...)

"ATSFontActivateFromFileSpecification? is deprecated in Leopard. Here's
another version that uses ATSFontActivateFromFileReference? and expects
fonts in subdir (Resources/fonts). Note: be sure to check "Preserve HFS
Data" in your build settings if you are copying font suitcases to your resource
directory."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Wed Apr 22, 2009 9:31 pm    Post subject: Reply with quote

degutis.org - Finding all URLs in a string

"If you’ve ever wanted to find all the URLs in any NSAttributedString or NSStr-
ing, then this post is for you! It’s quite simple, actually, just a few lines of co-
de. So let’s take a look..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat May 30, 2009 3:40 pm    Post subject: Reply with quote

MF - Cursor placement in UITextField

"I've got a UITextField on my interface that, ..."

"Method scrollRangeToVisible: is for class UITextView in iPhone SDK. Has
anyone solved this issue? "
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat May 30, 2009 11:24 pm    Post subject: Reply with quote

SO - How do I draw an NSString at an angle?

"Is there a set of string attributes I can specify that will draw the text at an
angle ..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Thu Jun 04, 2009 1:42 am    Post subject: Reply with quote

SO - How to parse strings in Objective C

"Can someone help me to extract int timestamp value from this string
"\/Date(1242597600000)\/" in Objective C"
[/b]
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Tue Jun 09, 2009 11:34 pm    Post subject: Reply with quote

SO - How to word wrap text?

"Realized that I'm really looking for a word-wrap algorithm. For example, I
want the text to wrap at 80 characters; where do I place line breaks so that
words are not split over two lines?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sun Jun 14, 2009 11:45 pm    Post subject: Reply with quote

MF - Need help parsing out my NSString!

"The problem with your program is the way that you are decoding the XML."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Jun 15, 2009 12:05 am    Post subject: Reply with quote

macresearch.org - Parsing CSV Data

"As you can see, parsing CSV data can be very easy, but it is not always the
case. When you have to deal with general CSV data, things can get quite
complicated, because you have to take account of the possibility that strings
contain quotations, and can even extend over multiple lines."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Jun 15, 2009 1:03 am    Post subject: Reply with quote

adc - String Programming Guide for Cocoa

"Strings Programming Guide for Cocoa describes how to create, search, con-
catenate, and draw strings. It also describes character sets, which let you se-
arch a string for characters in a group, and scanners, which convert numb-
ers to strings and vice versa."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Jun 15, 2009 1:18 am    Post subject: Reply with quote

adc - rangeOfCharacterFromSet:options:range:

Finds and returns the range in the receiver of the first character from a gi-
ven character set found in a given range with given options.


- (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask range:(NSRange)aRange

aSet - A character set. This value must not be nil.

mask - A mask specifying search options. The following options may be
specified by combining them with the C bitwise OR operator: NSCaseIn-
sensitiveSearch, NSLiteralSearch, NSBackwardsSearch.

aRange - The range in which to search. aRange must not exceed the bo-
unds of the receiver.
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Jun 15, 2009 1:22 am    Post subject: Reply with quote

adc - rangeOfString:options:range:

Finds and returns the range of the first occurrence of a given string, wi-
thin the given range of the receiver, subject to given options.


- (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)aRange

aString - The string for which to search. This value must not be nil.

mask - A mask specifying search options. The following options may be
specified by combining them with the C bitwise OR operator: NSCaseIn-
sensitiveSearch, NSLiteralSearch, NSBackwardsSearch, and NSAnchor-
edSearch. See String Programming Guide for Cocoa for details on these
options.

aRange - The range within the receiver for which to search for aString.
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sat Jul 11, 2009 7:19 pm    Post subject: Reply with quote

SO - How to remove first 3 characters from nsstring?

"You can use the NSString instance methods -substringWithRange: or
-substringFromIndex:"


SO - Remove newline character from first line of NSString

Code:
[string stringByTrimmingCharactersInSet:[NSCharacterSet newlineCharacterSet]]

"... will trim your string from any kind of newlines, if that's what you want."

"(See -stringByReplacingOccurrencesOfString:withString:options:range:
for details.)"


SO - Objective C NSString problem

"I have a NSString that I need to examine character by character..."

"The simplest way to go about it is using NSString's characterAtIndex: ..."

"-characterAtIndex: is the simplest approach, but the best is to drop down
to CFString and use a CFStringInlineBuffer..."


Last edited by Ike on Sat Jul 11, 2009 7:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sat Jul 11, 2009 7:34 pm    Post subject: Reply with quote

SO - stringWithContentsOfURL not working with certain string

"You probably need to escape some characters in the first URL, as follows:
-stringByAddingPercentEscapesUsingEncoding:"
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Wed Jul 29, 2009 1:43 am    Post subject: Reply with quote

SO - How to make first letter of NSString Capital in iPhone dev

"You have to do it by hand. This is one of those things that has been built
into categories so often by so many people that Apple probably doesn't dare
add it as an actual method since it would generate category collisions."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat Aug 08, 2009 10:46 pm    Post subject: Reply with quote

SO - Parsing HTML on the iPhone

"Can anyone recommend a C or Objective-C library for HTML parsing? It
needs to handle messy HTML code that won't quite validate."


html parsing with libxml

"Using libxml wont be a problem, assuming all of your documents are valid
XHTML, which is a subset of XML. If your documents are HTML (which inclu-
des "bad" things like the <br> tag) then libxml will probably fail to validate
and die because of the lack of closing tags (the same also goes for people
who don't close <p>)."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sun Aug 16, 2009 8:09 pm    Post subject: Reply with quote

so - iPhone string manipulation

"I need to remove the HTML tag, is there a way I can say remove everything
between ???"


EDIT:

so - Remove HTML Tags from an NSString on the iPhone

Code:
-(NSString *) stringByStrippingHTML {
NSRange r;
NSString *s = [[self copy] autorelease];
while ((r = [s rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound)
    s = [s stringByReplacingCharactersInRange:r withString:@""];
return s; }
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Thu Aug 20, 2009 2:10 pm    Post subject: Reply with quote

so - iPhone restrict user from entering space in textfield

"hi , i want to restrict user from entering space in a UITextField"
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Mon Aug 24, 2009 5:44 pm    Post subject: Reply with quote

SO - Finding a string in a string

"Here we look for @"co_2", failing if it's not found, then use an NSScanner to
grab everything from just after that string to the next occurrence of @"end".
Note that if 'end' is missing this code will silently grab the rest of the string."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat Sep 12, 2009 12:48 am    Post subject: Reply with quote

iphonedevsdk.com - Need help with getting data from the web

"Now, it works fine when it encounters Latin characters but when there are
Cyrilic or Chinese characters for example it won't recognize and display jibe-
rish.... What can be done?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Sep 14, 2009 10:24 pm    Post subject: Reply with quote

MF - NSData or NSString for CSV content?

"Should I just be using NSString's stringWithContentsOfFile and iterate over
the string to figure out the comma delimited data? .. I was looking at NSData
and I wasn't really clear how I iterate over the data in the NSData object. I
guess "byte" gets me the head pointer, and I increment the pointer to iterate
the length?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat Oct 03, 2009 12:29 am    Post subject: Reply with quote

MF - NSRange Location For StringComparison
(UISearchDisplayerController)


"The contacts app also does an anchored search. So if you type S into the
search box you get all contacts that have S as the first letter of the first or
last name but you don't get every contact that has an S anywhere in the
name. That's what the range does in the example."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sun Oct 18, 2009 9:08 pm    Post subject: Reply with quote

MF - NSXMLParser and Windows encoding.. How?

"I have an application and I want to make it read greek characters based
on NSWindowsCP1253StringEncoding . NSXMLParser refuses to parse string
created with this encoding, but I need that encoding, since my application
loads data from these pages."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Wed Nov 04, 2009 1:02 pm    Post subject: Reply with quote

SO - How to check if a string only contains alphanumeric
characters in objective C?


"I'm working on a small iphone project and i would need to check if the
userName entered only contains alphanumerical characters?"
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Thu Nov 12, 2009 11:51 pm    Post subject: Reply with quote

SO - Simple Way to Strip Tags In Obj-C

"The problem is simple enough, find the first '>' and extract everything from
there until the first '<' as an NSString. That's all I need to do."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Nov 16, 2009 9:20 pm    Post subject: Reply with quote

MF - Drawing text in a custom view

"I am trying to figure out how to draw text in a custom view. I can use the
function CGContextShowTextAtPoint to draw the text, but how do I get in-
formation about the text extent so I can center or right justify the string?"
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Mon Feb 15, 2010 7:52 pm    Post subject: Reply with quote

so - How to count words within a text string?

"This is not the most efficient way to count words. Specially not memory
wise since it will split the whole string into a temporary array that will then
be discarded. It is much better to simply look at runs of whitespace and
punctiation in the text. This can't be done in one line but it will be much
faster and will not use at least double the memory of the text."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Fri Feb 26, 2010 11:17 pm    Post subject: Reply with quote

MF - How to test if unichar is upper or lower case?

"Check out CFStringCapitalize, CFStringUppercase and CFStringLowercase
or the NSString equivalents."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Apr 19, 2010 5:27 pm    Post subject: Reply with quote

MF - How do I limit a Text Field length AND acceptable characters?

"I've arrived at the code to do either limiting the length OR acceptable
characters, but how do I do both for the same field."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon Apr 19, 2010 9:01 pm    Post subject: Reply with quote

SO - How to get the size of a NSString

"Trying to see if the string width of a string to see if it is bigger than a given
width of screen, case in which I have to "crop" it and append it with "...",
getting the usual behavior of a UILabel. string.length won't do the trick since
AAAAAAAA and iiiiii have the same length but different sizes (for example)."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Fri Apr 23, 2010 11:17 pm    Post subject: Reply with quote

SO - Is there something faster than -drawInRect...?

"To check and see if your string can be represented using the Mac Roman
character set, use something like the following:

if ([text canBeConvertedToEncoding:NSMacOSRomanStringEncoding])..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon May 03, 2010 9:22 pm    Post subject: Reply with quote

SO - iPad Custom Font

"UIAppFonts (Array - iPhone OS) specifies any application-provided fonts
that should be made available through the normal mechanisms. Each item
in the array is a string containing the name of a font file (including filename
extension) that is located in the application’s bundle."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sat Aug 07, 2010 12:23 pm    Post subject: Reply with quote

adc - NSAttributedString Class Reference

"Available in iOS 3.2 and later."

See: NSString UIKit Additions Reference
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Mon Aug 16, 2010 9:29 pm    Post subject: Reply with quote

MF - Searching An HTML NSString

"Now, I am trying to search the html variable ... In this example, I am trying
to copy everything from <div class="FP_Up_Item2"> to </div> into it's own
variable."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Sun Feb 13, 2011 4:21 pm    Post subject: Reply with quote

so - What is the “stringWithContentsOfURL” replacement ...?

"... the stringWithContentsOfURL command that is now deprecated as of
iPhone OS 3.0.
...
It has been replaced with stringWithContentsOfURL:encoding:error: or
stringWithContentsOfURL:usedEncoding:error:."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sun Mar 27, 2011 2:21 am    Post subject: Reply with quote

Jeff - Attributed Strings in iOS

"Ten months ago when the original iPad shipped, Apple released iOS 3.2,
and for the first time, iOS developers had access to NSAttributedString
and NSMutableAttributedString, objects designed to hold strings along
with font, paragraph, and style information. We no longer had to resort
to using heavy UIWebViews or complex Core Graphics calls to draw sty-
led text."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Fri Apr 01, 2011 10:03 pm    Post subject: Reply with quote

ADC - Reading data with an unknown encoding

"If you are forced to guess the encoding (and note that in the absence of
explicit information, it is a guess): Try stringWithContentsOfFile:usedEn-
coding:error: or initWithContentsOfFile:usedEncoding:error: (or the URL-
based equivalents).
..."
Back to top
View user's profile Send private message Visit poster's website
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Thu Oct 13, 2011 10:39 pm    Post subject: Reply with quote

beefyapps.com - Custom Fonts in iOS 4

"Up till now there hasn’t been an easy way to add custom fonts to your
iPhone applications. As of iOS 4 it has become very easy to do. Here is
what you need to do in order to add custom fonts..."


so - Can I embed a custom font in an iPhone application?

"Unfortunately, IB doesn't allow to initialize labels with custom fonts. See
this question to solve this problem. My favorite solution is to use custom
UILabel subclass..."
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Wed Feb 08, 2012 11:34 am    Post subject: Reply with quote

https://developer.apple.com/library/ios/ipad/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sat Apr 13, 2013 10:27 pm    Post subject: Reply with quote

so - How to style UITextview to like Rounded Rect text field?

"In the properties inspector I can't find anything like a border style property
so that I can make use a rounded rect, something like UITextField."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sun Apr 06, 2014 8:21 pm    Post subject: Reply with quote

github.com - jmenter / JAMValidatingTextField

"JAMValidatingTextField adds validation facilities to UITextField in iOS,
solving the problem of how to visually indicate that a text field's contents
are valid to the user.

It extends the basic UITextField to have three different validation states;
valid, invalid, and indeterminate. Validation is applied by either setting a
built-in validation type (email, URL, phone, or zip code) or by assigning a
validation block, an NSRegularExpression, or good old delegate."
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Thu Nov 30, 2017 1:27 pm    Post subject: Reply with quote

so - Replacement for stringByAddingPercentEscapesUsingEncoding in ios9?

Code:
NSString *str = ...; // some URL
NSCharacterSet *set = [NSCharacterSet URLHostAllowedCharacterSet];
NSString *result = [str stringByAddingPercentEncodingWithAllowedCharacters:set];
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Thu Dec 07, 2017 1:03 am    Post subject: Reply with quote

https://github.com/google/unigem-objective-c

This repository contains Unicode Gems, a Mac app, an iOS app, and an iOS keyboard that makes it easy for you to use interesting typefaces in contexts that don't allow fonted text.

As an iOS app, you get an iPhone UI, an iPad UI, and iPad split view support.
Back to top
View user's profile Send private message
delovski



Joined: 14 Jun 2006
Posts: 3523
Location: Zagreb

PostPosted: Mon May 13, 2019 3:56 pm    Post subject: Reply with quote

so - Can I select a specific block of text in a UITextField?

Code:
// Get current selected range , this example assumes is an insertion point or empty selection
UITextRange *selectedRange = [textField selectedTextRange];

// Calculate the new position, - for left and + for right
UITextPosition *newPosition = [textField positionFromPosition:selectedRange.start offset:-5];

// Construct a new range using the object that adopts the UITextInput, our textfield
UITextRange *newRange = [textField textRangeFromPosition:newPosition toPosition:selectedRange.start];

// Set new range
[textField setSelectedTextRange:newRange];
Back to top
View user's profile Send private message Visit poster's website
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sat Jun 15, 2019 11:26 pm    Post subject: Reply with quote

https://schiavo.me/2019/scanning-documents/

Scanning documents with Vision and VisionKit on iOS 13

In iOS 13, Apple's Vision framework also adds support for OCR (Optical Character Recognition), which allows you to detect and recognize text on scanned documents!
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sun Sep 29, 2019 3:58 pm    Post subject: Reply with quote

gadgethacks - iOS 13 Changes the Way You Navigate & Edit Text - Here's How to Place the Cursor, Make Selections, Perform Edits & More

"Apple streamlined the text editing system to make it easier and quicker to
use on an iPhone. So the changes to editing text in iOS 13 go relatively deep.
Apple even ditched the magnifying glass that'd appear when moving the
cursor, something that has been around since the very first iPhone."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sun Nov 17, 2019 8:40 pm    Post subject: Reply with quote

so - NSAttributedString with tabs

Code:
let text = "Name\t: Johny\nGender\t: Male\nAge\t: 25\nFavourites\t: Reading, writing"

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.tabStops = [NSTextTab(textAlignment: NSTextAlignment.Left, location: 150, options: [:])]
paragraphStyle.headIndent = 150

label.attributedText = NSAttributedString(string: text, attributes: [NSParagraphStyleAttributeName: paragraphStyle])
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sat Jan 21, 2023 7:14 pm    Post subject: Reply with quote

so - Search through NSString using Regular Expression

Code:
NSString *yourString = @"";
NSError *error = NULL;
NSRegularExpression *regex = [NSRegularExpression         
    regularExpressionWithPattern:@"(NS|UI)+(\\w+)"
    options:NSRegularExpressionCaseInsensitive
    error:&error];
[regex enumerateMatchesInString:yourString options:0 range:NSMakeRange(0, [yourString length]) usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop){
    // your code to handle matches here
    NSLog(@"Text Range %@", match.range);
    NSLog(@"Text %@", [yourString substringWithRange:match.range]);
}];
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sun Jan 22, 2023 12:34 am    Post subject: Reply with quote

mateam.net - HTML Escape Characters

"In the table below you can find the complete list of the most useful HTML
escape characters. Let us know if you use something we didn't cover so we
can update our list."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3033
Location: Europe

PostPosted: Sat Sep 09, 2023 4:46 pm    Post subject: Reply with quote

burnignorance.com - Padding Custom Margins In NSTextField

"Suppose we need to add padding to a text field or in a Table row (which is
generally a NSTextField cell).

This is possible but there in no direct method for this in Cocoa.

The padding can be added by subclassing NSTextFieldCell and by doing
customization as explained."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Mac Cocoa All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group