Using 'N in ADO.recordset.filter string - unicode

I have a VB6 ADO recordest that contains unicode text and need to filter it using .filter method with unicode text. I tried to use N' function but it does not work when I use it in .Filter text
Rs.filter = "Name = 'Apple'" 'OK
Rs.Filter = "Name = N'英語'" 'Not working for filter text
How I should wrap the text or I need to use another function?

Related

Access index of a list in Flutter/Dart

I would like to access an index of a string (e.g. 'Hello') and print it to the app (e.g. letter 'o'). This string has to be the input of the user.
This can be easily done using Python but I have to use Flutter/Dart in order to do it (mobile development).
Here is just an example of how this would be solve using Python:
my_word = input("Insert your word here: ")
print(my_word[4])
Use TextField to retrieve user's input:
A text field lets the user enter text, either with hardware keyboard
or with an onscreen keyboard.
Use Text to display the string that you retrieve:
The Text widget displays a string of text with single style.
Use the [] (index) operator to get the character at the index you specify:
final str = "Hello World";
print(str[4]); // Prints o
You can try split the string's letters in an array first.
my_word.split('')[4]
main() {
String val = "hello";
print(val[4]);
}

How to cut a string from the end in UIPATH

I have this string: "C:\Procesos\rrhh\CorteDocumentos\Cortados\10001662-1_20060301_29_1_20190301.pdf" and im trying to get this part : "20190301". The problem is the lenght is not always the same. It would be:
"9001662-1_20060301_4_1_20190301".
I've tried this: item.ToString.Substring(66,8), but it doesn't work sometimes.
What can I do?.
This is a code example of what I said in my comment.
Sub Main()
Dim strFileName As String = ""
Dim di As New DirectoryInfo("C:\Users\Maniac\Desktop\test")
Dim aryFi As FileInfo() = di.GetFiles("*.pdf")
Dim fi As FileInfo
For Each fi In aryFi
Dim arrname() As String
arrname = Split(Path.GetFileNameWithoutExtension(fi.Name), "_")
strFileName = arrname(arrname.Count - 1)
Console.WriteLine(strFileName)
Next
End Sub
You could achieve this using a simple regular expressions, which has the added benefit of including pattern validation.
If you need to get exactly eight numbers from the end of file name (and after an underscore), you can use this pattern:
_(\d{8})\.pdf
And then this VB.NET line:
Regex.Match(fileName, "_(\d{8})\.pdf").Groups(1).Value
It's important to mention that Regex is by default case sensitive, so to prevent from being in a situations where "pdf" is matched and "PDF" is not, the patter can be adjusted like this:
(?i)_(\d{8})\.pdf
You can than use it directly in any expression window:
PS: You should also ensure that System.Text.RegularExpressions reference is in the Imports:
You can achieve it by this way as well :)
Path.GetFileNameWithoutExtension(Str1).Split("_"c).Last
Path.GetFileNameWithoutExtension
Returns the file name of the specified path string without the extension.
so with your String it will return to you - 10001662-1_20060301_29_1_20190301
then Split above String i.e. 10001662-1_20060301_29_1_20190301 based on _ and will return an array of string.
Last
It will return you the last element of an array returned by Split..
Regards..!!
AKsh

Can't unescape escaped string with ABAP

I want to escape this string in SAPUI5 like this.
var escapedLongText = escape(unescapedLongText);
String (UTF-8 quote, space, Unicode quote)
" “
Escaped string
%22%20%u201C
I want to unescape it with this method, but it returns empty. Any ideas?
DATA: LV_STRING TYPE STRING.
LV_STRING = '%22%20%u201C'.
CALL METHOD CL_HTTP_UTILITY=>UNESCAPE_URL
EXPORTING
ESCAPED = LV_STRING
RECEIVING
UNESCAPED = LV_STRING.
I changed the code in SAPUI5 to the following:
var escapedLongText = encodeURI(unescapedLongText);
This results in: (like andreas mentioned)
%22%20%e2%80%9c
If I want to decode it later in SAPUI5, it can be done like this:
var unescapedLongText = unescape(decodeURI(escapedLongText));
The unescape needs to be done, because commas (for example) don't seem to be decoded automatically.

Using special characters as CASE keys in typoscript

I'm trying to send a mail via the powermail extension to different receivers, depending on the value a user has selected in a form dropdown. This practice of dynamic receivers is described in the powermail documentation. Basically:
receivers1.email = CASE
receivers1.email {
key.data = GP:tx_powermail_pi1|field|receiver
1 = TEXT
1.value = receivera#domain.org
default = TEXT
default.value = receiverb#domain.org
}
Now I'm facing the following problem: my values for "receiver" are not numeric (as in the example), but text values from a dropdown. Some of them contain spaces, some of them contain umlauts (öäüß). If I try to add …
Not wörking = TEXT
Not wörking.value = anotheremail#nowhere.org
Typo3 will complain and not update anything. (Bad property!
You must enter a property with characters a-z, A-Z and 0-9, no spaces!Nothing was updated!)
I tried simply 'escaping' the forbidden characters with a backslash, not working. Had an idea of converting the key.data via stdWrap rawUrlEncode, but did not work either. Google came up with this solution, but I don't understand what's going on and could not use it successfully.
How can I get around this? Thanks a lot for any kind of hint!
I pretty like your rawUrlEncode solution. Can you provide us your solution of it here? According to this online converter the result should be something like:
key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.rawUrlEncode = 1
Not%20w%C3%B6rking = TEXT
Not%20w%C3%B6rking.value = anotheremail#nowhere.org
Maybe for each CASE some signs like "%" are not allowed. In that case you maybe refer to the "replacement" function. https://docs.typo3.org/typo3cms/TyposcriptReference/8.7/Functions/Replacement/Index.html#replacement
key.data = GP:tx_powermail_pi1|field|receiver
key.stdWrap.replacement {
10 {
search.char = 32
replace = _
}
// Add umlauts and other signs!
}
Not_wörking = TEXT
Not_wörking.value = anotheremail#nowhere.org

Search removing comma using Entity Framework

I want to search a text that contains comma in database, but, there is not comma in the reference.
For example. In database I have the following value:
"Development of computer programs, including electronic games"
So, I try to search the data using the following string as reference:
"development of computer programs including electronic games"
NOTE that the only difference is that in database I have a comma in the text, but, in my reference for search, I have not.
Here is my code:
public async Task<ActionResult>Index(string nomeServico)
{
using (MyDB db = new MyDB())
{
// 1st We receive the following string:"development-of-computer-programs-including-electronic-games"
// but we remove all "-" characters
string serNome = nomeServico.RemoveCaractere("-", " ");
// we search the service that contains (in the SerName field) the value equal to the parameter of the Action.
Servicos servico = db.Servicos.FirstOrDefault(c => c.SerNome.ToLower().Equals(serNome, StringComparison.OrdinalIgnoreCase));
}
}
The problem is that, in the database, the data contains comma, and in the search value, don't.
In you code you are replacing "-" with "" and that too in your search string. But as per your requirement you need to change "," with "" for your DB entry.
Try doing something like this:
string serNome = nomeServico.ToLower();
Servicos servico = db.Servicos.FirstOrDefault(c => c.SerNome.Replace(",","").ToLower() == serNome);