Solved

how to find list & decimal separator values

Posted on 1998-05-24
7
562 Views
Last Modified: 2010-05-18
How does one find the list separator character and decimal symbol character in windows (3.1, 95 and NT). I guess there is an api function for this but I can't find it.
0
Comment
Question by:paulmaxwell
  • 3
  • 3
7 Comments
 
LVL 7

Expert Comment

by:kamall
ID: 1458561
Use the InStr function.
I will post some code example in few minutes.
0
 
LVL 7

Expert Comment

by:kamall
ID: 1458562
On your form put one text box, one label, and one command button.
Copy and paste the following code in the command button's click event:

Private Sub Command1_Click()

CharPos1 = InStr(1, Text1, ".", 1)
CharPos2 = InStr(1, Text1, ",", 1)

If CharPos1 > 0 And CharPos2 = 0 Then
    Label1 = "A '.' character found at position " & CharPos1
ElseIf CharPos1 = 0 And CharPos2 > 0 Then
    Label1 = "A ',' character found at position " & CharPos2
ElseIf CharPos1 > 0 And CharPos2 > 0 Then
    Label1 = "A '.' character found at position " & CharPos1 & ", and a ',' found a position " & CharPos2
Else
    Label1 = "Neither a '.' nor a ',' found"
End If

End Sub

Run the project, and enter something in the text box with a '.' or a ',' or both.

Regards
0
 

Author Comment

by:paulmaxwell
ID: 1458563
Perhaps I have not been sufficiently exact in my question. I have a utility that reads MS Project MPX files for conversion into another format. MPX files are a special form of a "comma separated value" file, and the list separator is a vital ingerdient in determining the various fields of data from each line of the file. In Germany the "list separator" is a semi-colon not a comma (and the decimal symbol is a comma not a period). I need to know what windows has set as the list separator and/or decimal symbol via the control panel - regional settings. There must be a windows api function to do this?
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 7

Expert Comment

by:kamall
ID: 1458564
Yes, this can be done through API.
I don't know how, though.
0
 
LVL 1

Accepted Solution

by:
fujicast earned 50 total points
ID: 1458565
Paul,

try to use GetNumberFormat on WIN32API. For reference, try MSDN CD.
0
 

Author Comment

by:paulmaxwell
ID: 1458566
I have found the answer. GetProfileString.

    Declare Function GetProfileString Lib "Kernel" (ByVal lpAppName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer) As Integer

    Dim lpAppName As String
    Dim lpKeyName As String
    Dim lpDefault As String
    Dim lpReturnedString As String
    Dim nSize As Long
    Dim rtnLength As Long
   
    nSize = 250
   
    lpReturnedString = Space(nSize)
   
    lpAppName = "Intl"
    lpKeyName = "sList"
    rtnLength = GetProfileString(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize)
    lpReturnedString = Left$(lpReturnedString, rtnLength)
    ' now have the list separator !
    ' more processing ...
   
    lpKeyName = "sDecimal"
    lpKeyName = "sList"
    rtnLength = GetProfileString(lpAppName, lpKeyName, lpDefault, lpReturnedString, nSize)
    lpReturnedString = Left$(lpReturnedString, rtnLength)
    ' now have the decimal symbol
    ' more processing ...


0
 

Author Comment

by:paulmaxwell
ID: 1458567
Thanks for trying - I will look into GetNumberFormat also.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now