Jump to content

.ini question


Kit

Recommended Posts

Right, call this a bit of a daft one but I've never actually messed with .ini files all that much beyond the real basics.

 

Suppose I have an option in my array like below:

 

[POLICE CARS]

Models = police,police2,police3

 

How would I load those models into an array? Neither GetValueString() nor GetValueModel appear to have methods for directly translating into arrays - would I have to create a function that essentially translates the entire string into smaller strings?

 

EDIT: Oh hah ignore me, completely forgot about the String.Split method...

Edited by Kit
Link to comment
Share on other sites

Right, call this a bit of a daft one but I've never actually messed with .ini files all that much beyond the real basics.

 

Suppose I have an option in my array like below:

 

[POLICE CARS]

Models = police,police2,police3

 

How would I load those models into an array? Neither GetValueString() nor GetValueModel appear to have methods for directly translating into arrays - would I have to create a function that essentially translates the entire string into smaller strings?

 

EDIT: Oh hah ignore me, completely forgot about the String.Split method...

 

All solved?

"You tell me exactly what you want, and I will very carefully explain to you why it cannot be."

Link to comment
Share on other sites

String.Split() is for sure the best way. A classic method is to cycle through a string, search for a given separator and, using positions of founded separator(s) copying shorter strings into an array. That's an overkill in times of libraries and stuff like that.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...