Questions tagged [ansistring]

An ANSI string is an array of 8 bit characters from the ANSI character set, a superset of the 7 bit ASCII character set, terminated by a binary zero. The ANSI string is primarily used in the C programming language and manipulated by a set of ANSI string functions provided by the C Standard Library. Most questions involving ansistring pertain to transformations to other character sets or other representations such as to UNICODE or std::string in C++.

54 questions
0
votes
1 answer

With Delphi 6/7, how can I convert an AnsiString in a different CharSet, to hex String UTF-8?

I need to draw a barcode (QR) with Delphi 6/7. The program can run in various windows locales, and the data is from an input box. On this input box, the user can choose a charset, and input his own language. This works fine. The input data is only…
MyICQ
  • 987
  • 1
  • 9
  • 25
0
votes
1 answer

Delphi XE6 FireDac Param value chinese characters string assigned using property Value (variant type)

I am facing a strange behaviour with FireDAC and Chinese character strings (guess this occurs also with any other unicode string). I have a query like this: Q.SQL.Add('select count(*) as CNT from TABLE where F = :P'); In the table the field F is a…
Tomaso Tosolini
  • 233
  • 2
  • 9
0
votes
1 answer

AnsiString header file

I am migrating from an old version of Borland C++ to the newest. In my code I had used String (AnsiString). In the new compiler it does not recognize String or AnsiString as a valid type, so I put in vcl.h in the file where I use String. Now I get…
FWE1
  • 11
  • 2
0
votes
0 answers

Handling strings with identical values?

I am using Delphi 10.3 to extend some working code. I am having a problem with strings. I'm filling a record. Only the first 2 fields, name and org_name, are giving me problems. When name and org_name have values different from each other there is…
David U
  • 943
  • 1
  • 8
  • 22
0
votes
0 answers

How to force Delphi's TADOConnection use ansistring for Command?

I have problem with encoding when I insert into dbf file through ADO. Connecting string: 'Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties="dBASE IV";Data Source='+extractfilepath(ParamStr(0))+';'+ 'User ID=Admin;Password=' In a insert…
Jacek U
  • 53
  • 9
0
votes
2 answers

Implicit string cast with potential data loss from 'string' to 'AnsiString' / ADOQuery

got here Delphi 10.3 Update 1. On the Form I have a ADOQuery which has a Field named ExtraText this field is TWideStringField . In my Programm I assign it like this : PrintPosQueryRack.Value:=PrintPosQueryExtraText.Value; if I hover the cursor…
user1937012
  • 1,031
  • 11
  • 20
0
votes
1 answer

How to check a String for special characters?

I'm working on a problem in C++ and here's my question: I get a string from an object and I want to detect if there is a character that is not alphanumeric or a special character like /, (, $ and so on. I cannot imagine of a way other than asking if…
Shijury
  • 39
  • 3
0
votes
1 answer

Checking for a character at end of AnsiString (and if finding), deleting it

I would like to check an AnsiString for a specific last character (in this case "f") and if finding it, then amending the AnsiString to remove it Its likely to be obvious, but so far my searches have not worked. A typical string it would be reading…
BarryK
  • 11
  • 5
0
votes
1 answer

Truncate an AnsiString

I'm working with Rad Studio, c++ builder. The size of the AnsiString size is ~2^31 characters. How should I check the length? if(ExportFileName.Length() > ??? ) { ExportFileName. ??? } m_ActionsHelper.LastPdfFile = ExportFileName;
0
votes
1 answer

Proper way to zero a AnsiString object

How do we zero a AnsiString object? For example: void TesteClass::test() { AnsiString cardNumber = "1234567890123456"; .. } The AnsiString object is destroyed automatically, but its internal data is not cleaned, so a memory acquisition tool…
Juliano
  • 821
  • 6
  • 21
0
votes
0 answers

Using memcpy to copy BYTE array parts into AnsiString

Got following situation: AnsiString IP_Adress; int Port; BYTE ReadBuffer[2048]; using this works perfect: memcpy(&Port, &ReadBuffer[48],1); for reading out Potnummer i need two Bytes, so Port content after memcpy is: Port == 5000; But using…
Lama Dingo
  • 123
  • 1
  • 11
0
votes
1 answer

c language. SetLength, array of structs

type TS = record FN, RN: String; end; var Sy: array of TS; S: ^String; ... SetLength(Sy,2); begin Sy[0].FN:='123'; Sy[0].RN:='bad'; Sy[1].FN:='345'; Sy[1].RN:='000'; …
0
votes
1 answer

Cast or convert AnsiString to NSMutableData in Objective Pascal unit over Cocoa classes

Writing a Lazarus unit with Objective Pascal to interface with Cocoa classes on Mac OS X. I want to pass an AnsiString from the FreePascal caller to a Cocoa class requiring an NSMutableData parameter value. How can I cast or convert the AnsiString…
Lor
  • 141
  • 10
0
votes
1 answer

XE6 Ansi/Unicode-String Linker Errors (Unresolved Externals)

My senario is to port my projects from XE3 to XE6. I having these unresolved extrenals when I'm switching calling convention from C to stdcall. Starting from there, UnicodeString(), ~UnicodeString() (any other) become unresolved. I'd compare…
salocin
  • 21
  • 3
0
votes
0 answers

Using 1252 codepage AnsiString in computer with 1251 codepage

DelphiXE application uses ANSI Armenian characters - they use codes in Extended ASCII character set and do not have special CodePage. When Computer Active Code Page is 1252 all is OK. When Computer ACP is not 1252 (1251 for example) then the values…
Avrob
  • 533
  • 2
  • 10
  • 20