Click here to Skip to main content
15,886,038 members

Separated value in string

Luiey Ichigo asked:

Open original thread
Hi all,

I'm writing a code which get value from configuration settings file (*.ini)

Here are the sample of item that I have in the *.ini:

VB
[MERCHANT]
SPLITTER=,
MERCH1=1,P,PAYMENT
MERCH2=0,R,ROADTAX
MERCH3=1,S,SUMMON


I will retrieve this value using this code:

VB
m_IniMainObj.CurrentSection = INI_SCREENCFG_SECT_MERCHANT
m_strSplitter=m_IniMainObj.GetStrVal(INI_SPLITTER_KEY,"-")
m_strMerch1 = m_IniMainObj.GetStrVal(INI_MERCHANT_1_KEY, String.Empty)
m_strMerch2 = m_IniMainObj.GetStrVal(INI_MERCHANT_2_KEY, String.Empty)
m_strMerch3 = m_IniMainObj.GetStrVal(INI_MERCHANT_3_KEY, String.Empty)



The value is current set into m_strXXXXX as string. But I want to read the string an want to separated the value with this:

(1,P,PAYMENT)
(Boolean,String,String)

so I can hold the value whether it is True or False for 1st comma, ID for 2nd comma and description for 3rd comma and I want to save it in a declaration

VB
Dim bVisible as Boolean 'To hold 1st comma value (Boolean)
Dim strID as String 'To hold 2nd comma value (String)
Dim strDesc as String 'To hold 3r comma value (String)



Can someone please help me? I'm sorry if my question is quite messy but if you have some clearance, I will explain..
Tags: Visual Basic

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900