I Have Problem when users ask me to use - divider on parameter , here's what I've tried :
Public Function Auth(ByVal Subscriber-id As String,
ByVal Country-Code As String,
ByVal Resource-ID As String,
ByVal Action-ID As String,
ByVal IP-Address As String) As AuthOut
actually that script give me an error, to put comma , or ) .
is it possible to naming parameter like that?
No it is not. Hyphen is not an allowed character in parameter name.
See restrictions on Declared Element Names:
An element name:
Must begin with an alphabetic character or an underscore (_).
Must contain only alphabetic characters, decimal digits, and underscores.
Must contain at least one alphabetic character or decimal digit it if begins with an underscore.
Must not be more than 1023 characters long.
Related
#"^(?=.*[0-9]+.*)(?=.*[a-zA-Z]+.*)[0-9a-zA-Z]{6,}$"
I am using this regular expression for password validation which gives one upper case, one lowercase and a number. But what I want is a special character in it but it should optional but above mentioned must be mandatory.
This will allow these special characters: - (hyphen), * (asterisk) and _ (underscore).
^(?=[-_*]*)(?=.*[0-9]+.*)(?=.[a-zA-Z]+.)[-*_0-9a-zA-Z]{6,}$
If you want to add your own special characters, add them into this part of the regex [-*_0-9a-zA-Z] (inside the square bracket)
I read data from a excel file.
The cols of internal table all are char128, there are 2 cols contain only digital with decimal point. So I need to check the fields only contain digital or digital with decimal point.
The function module NUMERIC_CHECK, just can check only digital, if the digital with decimal point it will be useless.
You may use CO (contains only):
IF value CO '1234567890.'.
"OK
ELSE.
"Error"
ENDIF.
Maybe you need also a space in your IF _ CO-statement.
This check does not detect multiple decimals points (e.g. 123.45.67.89).
Newer versions of ABAP support regular expressions.
If you have also spaces in your string, you may add them into the CO-value:: IF value CO '1234567890 .'.
You might try to use REGEX. The report DEMO_REGEX_TOY lets you input strings and test regular expressions against them.
Someone more experienced with REGEX in general might be able to make this a little more versatile but here's what I came up with:
-?[0-9]+(\.[0-9]*)?
-? Optionally match the '-' character (allows for negatives or non-negatives
[0-9]+ matches digits (the + makes it match 1 or more)
\.? optionally matches the '.' character (the \ is needed as '.' is an operator)
([0-9]+)? optionally matches any digits after the decimal
if you want to check if the string is a valid decimal, you could use the following module function : 'HRCM_STRING_TO_AMOUNT_CONVERT', which allow you to convert a string to its numeric counterpart, given the string, the decimal separator and the thousand separator.
regards
Another way to check for number:
data: float_value type f.
try.
float_value = <your string value here>.
catch cx_sy_conversion_no_number.
" not a valid number
endtry.
hello
Is it possible to get character character code in Visual Basic 2008 and to get character from character code ( Without form1_keyDown or KeyUp)?.
What i need is two functions, first to get character code of a character, and second to get character from character code.
thank you.
From Unicode code point (not, strictly speaking, ASCII) to character: Chr and ChrW.
Inverse direction: Asc and AscW.
To get the character representation in specific encodings you need to use the methods of the System.Text.Encoding class.
From MSDN:
Public Function Chr(ByVal CharCode As Integer) As Char
Public Function ChrW(ByVal CharCode As Integer) As Char
I have a string value read in from a CSV file. The CSV file contains 7 NULL bytes, I have confirmed this by opening it in a hex editor and sure enought there are 7 0x0 bytes in there. This string is causing me pain.
In vb.net when I check the strlen of this string it returns a value of 7 and if i do a String.IsNullOrWhitespace it returns false.
I cannot understand why this is? I have split the string into a byte array and each byte is 0x0, which is null/nothing. A string = Nothing comparison also fails.
I want to be able to replace this string with a string of my own but I cannot do this dynamically. Any suggestions why this string returns a length of 7 even though each byte is 0x0?
Unfortunately the null character seven times is not an empty string, or a null string. Remember in .NET a string is at some level a pointer to a character array. A string is null if this pointer is set to null. A string is empty if the pointer points to a zero length array. In this case the pointer points to a length seven array of null characters (the byte being all zeros).
Null String
A ->
Empty String
A -> ()
Your String
A -> ((0)(0)(0)(0)(0)(0)(0))
You can test for this null character by using
char nullChar = char.ConvertFromUtf32(0);
string nullCharString = new String(nullChar);
bool hasNullChar = A.Contains(nullCharString);
The Null character is not whitespace, and your string reference is not Nothing, so I would expect String.IsNullOrWhitespace() to return false
A character with the character code zero is a character just like any other. If you have a string with seven such characters, the length is seven. The NUL character is not a white-space character, and a string containing NUL characters is not the same as a string reference that is null (Nothing).
You could use the Trim method (or TrimEnd) to remove the NUL characters by specifying that it should trim NUL characters: str = str.Trim(Chr(0)), but I think that you should rather ask yourself why there is NUL characters in the string to start with.
Are you reading the data properly from the file? A common error is to use the Read method to read from a stream, but ignoring it's return value and thus ending up with a buffer only partly filled with data from the stream. As a byte array is filled with zeroes when you create it, the bytes not set by the Read operation would remain zero and become NUL characters when you decode the data into a string.
IsNullEmptyOrWhitespace checks if the variable itself is null, not if the string contains NULL characters. A NULL character is not a whitespace. So this check also fails.
I suggest you use a Trim(), after the test. In C# this will look like:
bool MyNullCheck(string s) {
if (s == null) return false;
s = s.Trim(new string(char.ConvertFromUtf32(0), 1));
return string.IsNullEmptyOrWhiteSpace(s);
}
Try to convert to VB (not checked)
Function MyNullCheck(s as String) as Boolean
If s Is Nothing Then
Return False
End If
s = s.Trim(New String(vbNullChar, 1))
Return String.IsNullEmptyOrWhiteSpace(s)
End Function
A null string is one that hasn't been initialised or has been set to Nothing.
An empty string is one that contains the empty string String.Empty or "".
Whitespace characters are space, tab, newline, carriage return and lots more. But not the null character.
Your string is neither empty nor Nothing. It contains 7 characters, each one is the null character - so it is not whitespace.
You could use String.Replace to remove the zero characters? Something like this
s = s.Replace(vbNullChar, "")
I bet you have run into an encoding issue. Try reading the file as UTF-16
I know that I can validate an input field by adding a inputmaskvalidator tag. I read the documentum doc :
The mask character string:
: numeric characters
& : all characters
A : alphanumeric characters only
? : alphabetic characters only
U : uppercase alphabetic characters only
L : lowercase alphabetic characters only
Example: date mask ##/##/## permits
the input date 12/24/95 To use one of
the mask characters as a literal
member of the mask string, place a
double slash (\) preceding the
character.
Let's guess I want to accept double only to store it as a double in the content server. What must be the inputmask value?
Something like that?
<dmf:inputmaskvalidator inputmask="#.#" controltovalidate="my_double" name="my_double_validator"/>
or
<dmf:inputmaskvalidator inputmask="##.##" controltovalidate="my_double" name="my_double_validator"/>
You must use other type of validator. Inputmaskvalidator is bad for your purpose. Use for example regexpvalidator. Example you can find on this page: