Dear all,I have this value in a field “3DTV345C7” i need to get the number of characters (4) and number of numerics (5) how can i do this.
thanks
shana
Dear all,I have this value in a field “3DTV345C7” i need to get the number of characters (4) and number of numerics (5) how can i do this.
thanks
shana
Subject: Lotus Script to Count number of characters and numerics in a field
take length of that fieldthen use for loop lik
for i=0 to count(filed)
take field first character
then use like method then if first character is leeter keep count as 1 and go for secong character if it is number make count1 as 1 go on repeating
Subject: RE: Lotus Script to Count number of characters and numerics in a field
Thanks reddy…i was trying to do what you said…but how can i get the first character couldn’t do it with left…Pls replyshana
Dim se As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim cdoc As NotesUIDocument
Set db =se.CurrentDatabase
Set cdoc = ws.CurrentDocument
Set doc=cdoc.Document
Dim a,i As Integer
a=Len(doc.test(0))
For i=0 To a
i=i+1
'take field first character
Next
Subject: RE: Lotus Script to Count number of characters and numerics in a field
This is an example of how to do it in lotusscript. Any non numeric is counted as a character so if you need to check for things like punctuation then you will need to run additional tests.
Dim value as String
Dim char as String
Dim numbers as Integer
Dim characters as Integer
value = “3DTV345C7”
For i = 1 to Len(value)
char = Mid(value, i, 1)
If IsNumeric(char) then
numbers = numbers + 1
Else
characters = characters + 1
End If
Next
Subject: RE: Lotus Script to Count number of characters and numerics in a field
Just another solution
After declarations,
tmpstr = “3DTV345C7”
ctr = Len(tmpstr)
For i = 1 To ctr
fstr = Mid$(tmpstr, i, 1)
If Asc(fstr) >= 49 And Asc(fstr) <= 55 Then
k = k+1
Else
j = j+1
End If
Next
Msgbox Cstr(k) & "|" & Cstr(j)
Subject: Thank you all…
Subject: RE: Lotus Script to Count number of characters and numerics in a field
I took a different route, hopefully you can use formula to achieve your goal. If not, maybe thie will lead you in the right direction for converting to LS format.
nums := “0” : “1” : “2” : “3” : “4” : “5” : “6” : “7” : “8” : “9”;
all := “3DTV345C7”;
lets := @Trim(@ReplaceSubstring(all; nums; “”));
l := @Length(lets);
n := @Length(all) - l;
@Prompt([Ok]; “”; "There are " + @Text(l) + " letters and " + @Text(n) + " numbers in - " + all)