Parsing string to key=>val pairs
Parsing string to key=>val pairs
- Subject: Parsing string to key=>val pairs
- From: Michael Carter <email@hidden>
- Date: Thu, 30 Jun 2005 16:19:10 -0700
Hey all.
I've been trying to find the best way to parse a large string into a
dictionary with key=>value pairs taken from colon-delimited items in
the string. I've been messing with NSString's methods and looking at
NSScanner, however it seems like quite a lot of work that way. The
input is an x509 certificate, so there are about 12 key:value
pairings that have various amounts of whitespace in-between.
Should I continue coaxing the string with NSString/NSScanner, or is
there a better way? The bare minimum I need to extract is shown in
bold, however I'd like to read in some other properties.
sample:
Certificate:
Data:
Version: 1 (0x0)
Serial Number: 160 (0xa0)
Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=California, L=Cupertino, O=Some Computer
Company, OU=Some Org unit, CN=A Root Cert/
emailAddress=email@hidden
Validity
Not Before: Jun 7 23:48:00 2005 GMT
Not After : Jun 7 23:48:00 2007 GMT
Subject: C=US, ST=California, L=Cupertino, O=Some Computer
Company, OU=Some Org unit, CN=server.somecompany.com
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
Thanks.
#mikec
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden