CIN: Converting a C String to a LabVIEW String
Hi all,
I have been developing CINs in Microsoft Visual C++ 6.0 for LabVIEW as
project needs. However, I am having a problem with converting a C String
to a LabVIEW String in CIN.
I used two ways to try to make the conversion work that were LStrPrintf
and MoveBlock as stated as following:
1. LStrPrintf
#include "extcode.h"
#include "hosttype.h"
#include "windows.h"
struct teststrct{
const char* test;
struct teststrct testinstance;
typedef struct {
LStrHandle test
} TD1;
CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
char *tempCStr = NULL;
strcpy(tempCStr, testinstance.test); // this would cause LabVIEW crash!
LStrPrintf(testcluster->test, (CStr) "%s", tempCSt
r);
// but if I assigned tempCStr as tempCStr = "test", the string value
"test" could be passed to LabVIEW without any problems.
2. MoveBlock
#include "extcode.h"
#include "hosttype.h"
#include "windows.h"
struct teststrct{
const char* test;
struct teststrct testinstance;
typedef struct {
LStrHandle test
} TD1;
CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
char *tempCStr = NULL;
int32 len;
tempCStr = (char *)&testinstance.test; //since strcpy didn't work, I
used this way to try to copy the const char* to char*.
len = StrLen(tempCStr);
if (err = NumericArrayResize(uB, 1L, (UHandle*)&testcluster->test,
len))
*Error = LVFALSE;
goto out;
MoveBlock(&tempCStr, LStrBuf(*testcluster->test), len); // the string
was able to passed to LabVIEE, but it was unreadable.
out:
Did I do anything wrong? Any thougths or suggestions would be very
appreciated!
Thank you so much for your response, Greg. However, I still have problem after making
corresponding modification for LStrPrintf approach:
int32 len;
char tempCStr[255] = "";
strcpy(temCStr, testinstance.test);
len = StrLen(tempCStr);
LStrPrintf(testcluster->test, (CStr) "%s", tempCStr);
LStrLen(*testcluster->test) = len;
LabVIEW crashes. Any ideas?
Greg McKaskle wrote:
> The LStrPrintf example works correctly with the "test" string literal because
> tempCStr= "test"; assigns the pointer tempCStr to point to the buffer containing
> "text". Calling strcpy to move any string to tempStr will cause
> problems because it is copying the string to an uninitialized pointer,
> not to a string buffer. There isn't anything wrong with the LStrPrintf
> call, the damage is already done.
>
> In the moveblock case, the code:
> tempCStr = (char *)&testinstance.test; //since strcpy didn't work, I
> used this way to try to copy the const char* to char*.
>
> doesn't copy the buffer, it just changes a pointer, tempCStr to point to
> the testinstance string buffer. This is not completely necessary, but
> does no harm and is very different from a call to strcpy.
>
> I believe the reason that LV cannot see the returned string is that the
> string size hasn't been set.
> Again, I'm not looking at any documentation, but I believe that you may
> want to look at LStrLen(*testcluster->test). I think it will be size of
> the string passed into the CIN, and it should be set to len before returning.
>
> Greg McKaskle
>
> > struct teststrct{
> > ...
> > const char* test;
> > ...
> > };
> >
> > struct teststrct testinstance;
> >
> > typedef struct {
> > ...
> > LStrHandle test
> > ...
> > } TD1;
> >
> > CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
> >
> > char *tempCStr = NULL;
> >
> > ...
> >
> > strcpy(tempCStr, testinstance.test); // this would cause LabVIEW crash!
> > LStrPrintf(testcluster->test, (CStr) "%s", tempCStr);
> > // but if I assigned tempCStr as tempCStr = "test", the string value
> > "test" could be passed to LabVIEW without any problems.
> >
> > ...
> > }
> >
> > 2. MoveBlock
> >
> > #include "extcode.h"
> > #include "hosttype.h"
> > #include "windows.h"
> >
> > struct teststrct{
> > ...
> > const char* test;
> > ...
> > };
> >
> > struct teststrct testinstance;
> >
> > typedef struct {
> > ...
> > LStrHandle test
> > ...
> > } TD1;
> >
> > CIN MgErr CINRun(TD1 *testcluster, LVBoolean *Error) {
> >
> > char *tempCStr = NULL;
> > int32 len;
> > ...
> >
> > tempCStr = (char *)&testinstance.test; //since strcpy didn't work, I
> > used this way to try to copy the const char* to char*.
> > len = StrLen(tempCStr);
> >
> > if (err = NumericArrayResize(uB, 1L, (UHandle*)&testcluster->test,
> > len))
> > {
> > *Error = LVFALSE;
> > goto out;
> > }
> >
> > MoveBlock(&tempCStr, LStrBuf(*testcluster->test), len); // the string
> > was able to passed to LabVIEE, but it was unreadable.
> > ...
> >
> > out:
> > ...
> >
> > }
> >
> > Did I do anything wrong? Any thougths or suggestions would be very
> > appreciated!
Similar Messages
-
Labview string to which matlab data type
Hi
I'm using my labview programme to write a file which will be read off using matlab. I face problem of enabling the matlab to read the 'string' datatype written by labview. Those in 'double' datatype is fine. There's no string data type in matlab except 'char' which is not showing wat i've written.
Message Edited by 1000 on 01-11-2008 10:05 AM
Message Edited by 1000 on 01-11-2008 10:07 AMIf you use a MATLAB Script node, then do this to get the MATLAB string to a LabVIEW string:
Message Edited by Derek Price on 01-11-2008 01:35 PM
Attachments:
matlab_string_to_labview.png 10 KB -
How to convert labview string to C-style string?
I have a labview string that is 100 characters longs. It stores a C-style, Null-terminated string, and it is only 10 characters long. So, is there any way that I can convienently get the shorter Null-terminated string out from the long labview string, other than programatically search for the NULL character in the labview string and get the sub string?
Well, IF you know the position of the null char, you can use String Subset, but with a string with a maximum length of 100 bytes you won't be saving any real performance and you can perform the same thing by wiring the index into the Offset input of S/SS. What's the problem with searching for the null char?
Try to take over the world! -
Convert an array of strings into a single string
Hi
I am having trouble trying to figure out how to convert an array of strings into a single string.
I am taking serial data via serial read in a loop to improve data transfer. This means I am taking the data in chunks and these chunks are being dumped into an array. However I want to combine all elements in the array into a single string (should be easy but I can't seem to make it work).
In addition to this I would also like to then split the string by the comma separator so if any advice could be given on this it would be much appreciated.
Many Thanks
Ashley.Well, you don't even need to create the intermediary string array, right? This does exactly the same as CCs attachment:
Back to your serial code:
Why don't you built the array at the loop boundary? Same result.
You could even built the string directly as shown here.
Message Edited by altenbach on 12-20-2005 09:39 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
autoindexing.png 5 KB
concatenate.png 5 KB
StringToU32Array.png 3 KB -
What is the best way to convert a cluster into byte array or string
I'm writing a program that sends UDP packets and I've defined the data I want to send via large clusters (with u8/u16/u32 numbers, u8/u16/u32 arrays, and nested clusters). Right before sending the data, I need to convert the clusters either into strings or byte arrays. The flatten to string function is almost perfect for this purpose. However, it's appending lengths to arrays and strings which renders this method useless, as far as I can tell.
As I have many of these clusters, I would rather not hard code the unbundle by names and converting/typecasting to byte arrays or strings for each one.
Is there a feature or tool I am overlooking?
Thank you!deceased wrote:
Flatten to string has a boolean input of "Prepend string or array size" ... The default value is true.
That only specifies if a string or array size should be prepended if the outermost data element is a string or array. For embedded strings or arrays it has no influence. This is needed for the Unflatten to be able to reconstruct the size of the embedded strings and arrays.
The choice to represent the "Strings" (and Arrays) in the external protocol to LabVIEW strings (and arrays) is actually a pretty bad one unless there is some other element in the cluster that does define the length of the string. An external protocol always needs some means to determine how long the embedded string or array would be in order to decode the subsequent elements that follow correctly.
Possible choices here are therefore:
1) some explicit length in the protocol (usually prepended to the actual string or array)
2) a terminating NULL character for strings, (not very friendly for reliable protocol parsing)
3) A fixed size array or string
For number 1) and 2) you would always need to do some special processing unless the protocol happens to use explicitedly 32 bit integer length indicators directly prepended before the variable sized that.
For number 3) the best representation in LabVIEW is actually a cluster with as many elements inside as the fixed size.
-
Conversion failed when converting date and/or time from character string
Hi experts,
I'm trying running a query in Microsoft Query but it gives the following error message:
"conversion failed when converting date and/or time from character string"
when asks me the data I'm inserting 31-01-2014
i've copy the query form the forum:
SELECT T1.CardCode, T1.CardName, T1.CreditLine, T0.RefDate, T0.Ref1 'Document Number',
CASE WHEN T0.TransType=13 THEN 'Invoice'
WHEN T0.TransType=14 THEN 'Credit Note'
WHEN T0.TransType=30 THEN 'Journal'
WHEN T0.TransType=24 THEN 'Receipt'
END AS 'Document Type',
T0.DueDate, (T0.Debit- T0.Credit) 'Balance'
,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')<=-1),0) 'Future'
,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=0 and DateDiff(day, T0.DueDate,'[%1]')<=30),0) 'Current'
,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>30 and DateDiff(day, T0.DueDate,'[%1]')<=60),0) '31-60 Days'
,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>60 and DateDiff(day, T0.DueDate,'[%1]')<=90),0) '61-90 Days'
,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>90 and DateDiff(day, T0.DueDate,'[%1]')<=120),0) '91-120 Days'
,ISNULL((SELECT T0.Debit-T0.Credit WHERE DateDiff(day, T0.DueDate,'[%1]')>=121),0) '121+ Days'
FROM JDT1 T0 INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
WHERE (T0.MthDate IS NULL OR T0.MthDate > ?) AND T0.RefDate <= ? AND T1.CardType = 'C'
ORDER BY T1.CardCode, T0.DueDate, T0.Ref1Hi,
The above error appears due to date format is differnt from SAP query generator and SQL server.
So you need convert all date in above query to SQL server required format.
Try to convert..let me know if not possible.
Thanks & Regards,
Nagarajan -
Needing to convert a local "numeric" value to a string type using the expression browser.
I am trying to convert a "numeric" local value to a string through the expression browser in order to supply a string arguement. I am currently looking through the expression browser options, but I can not find any type of Number "ToString()" function.
Solved!
Go to Solution.Hi,
Str() function
ie
locals.tostring = Str(locals.dec_value)
Regards
Ray Farmer -
I have a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".
USE [Runtime]
GO
/****** Object: UserDefinedFunction [dbo].[f_Pinto_Graf_P_Opt] Script Date: 06/11/2013 08:47:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[f_Pinto_Graf_P_Opt] (@fechaInicio datetime, @fechaFin datetime)
-- Declaramos la tabla "@Produc_Opt" que será devuelta por la funcion
RETURNS @Produc_Opt table ( Hora datetime,NSACOS int, NSACOS_opt int)
AS
BEGIN
-- Crea el Cursor
DECLARE cursorHora CURSOR
READ_ONLY
FOR SELECT DateTime, Value FROM f_PP_Graficas ('Pinto_CON_SACOS',@fechaInicio, @fechaFin,'Pinto_PRODUCTO')
-- Declaracion de variables locales
DECLARE @produc_opt_hora int
DECLARE @produc_opt_parc int
DECLARE @nsacos int
DECLARE @time_parc datetime
-- Inicializamos VARIABLES
SET @produc_opt_hora = (SELECT * FROM f_Valor (@fechaFin,'Pinto_PRODUC_OPT'))
-- Abre y se crea el conjunto del cursor
OPEN cursorHora
-- Comenzamos los calculos
FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
/************ BUCLE WHILE QUE SE VA A MOVER A TRAVES DEL CURSOR ************/
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status = -2)
BEGIN
-- Terminamos la ejecucion
BREAK
END
-- REALIZAMOS CÁLCULOS
SET @produc_opt_parc = (SELECT dbo.f_P_Opt_Parc (@fechaInicio,@time_parc,@produc_opt_hora))
-- INSERTAMOS VALORES EN LA TABLA
INSERT @Produc_Opt VALUES (@time_parc,@nsacos, @produc_opt_parc)
-- Avanzamos el cursor
FETCH NEXT FROM cursorHora INTO @time_parc,@nsacos
END
/************ FIN DEL BUCLE QUE SE MUEVE A TRAVES DEL CURSOR ***************/
-- Cerramos el cursor
CLOSE cursorHora
-- Liberamos los cursores
DEALLOCATE cursorHora
RETURN
ENDYou can search the forums for that error message and find previous discussions - they all boil down to the same problem. Somewhere in your query that calls this function, the code invoked implicitly converts from string to date/datetime. In general,
this works in any version of sql server if the runtime settings are correct for the format of the string data. The fact that it works in one server and not in another server suggests that the query executes with different settings - and I'll assume for
the moment that the format of the data involved in this conversion is consistent within the database/resultset and consistent between the 2 servers.
I suggest you read Tibor's guide to the datetime datatype (via the link to his site below) first - then go find the actual code that performs this conversion. It may not be in the function you posted, since that function also executes other functions.
You also did not post the query that calls this function, so this function may not, in fact, be the source of the problem at all.
Tibor's site -
SAP query error - 1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string. 'Received Alerts' (OAIB)
SELECT
CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
WHEN T0.DocStatus = 'C' THEN 'CLOSED' END AS 'Document Status',
T0.DocDate AS 'Posting Date',
T0.DocNum AS 'Doc.No',
T0.NumAtCard,
T0.TransId AS 'Trans. No.',
T0.Comments AS 'Remarks',
T0.CardCode AS 'Offset Acct',
T0.CardName AS 'Offset Acct Name',
sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
T3.DueDate AS 'Cheque Date',
T3.CheckSum AS 'Amount'
FROM ODPO AS T0 LEFT OUTER JOIN
VPM2 AS T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry LEFT OUTER JOIN
OVPM AS T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
VPM1 AS T3 ON T2.DocEntry = T3.DocNum
where T0.DocDate>='[%0]' and T0.DocDate<='[%1]'Hi,
Try this:
SELECT
CASE WHEN T0.DocStatus = 'O' THEN 'OPEN'
WHEN T0.DocStatus = 'C' THEN 'CLOSED' END AS 'Document Status',
T0.DocDate AS 'Posting Date',
T0.DocNum AS 'Doc.No',
T0.NumAtCard,
T0.TransId AS 'Trans. No.',
T0.Comments AS 'Remarks',
T0.CardCode AS 'Offset Acct',
T0.CardName AS 'Offset Acct Name',
sum(T0.DocTotal) + (T0.WTSum) as 'DocTotal',
T3.DueDate AS 'Cheque Date',
T3.CheckSum AS 'Amount'
FROM ODPO T0 LEFT OUTER JOIN
VPM2 T1 ON T0.ObjType = T1.InvType AND T0.DocEntry = T1.DocEntry
LEFT OUTER JOIN
OVPM T2 ON T2.DocEntry = T1.DocNum LEFT OUTER JOIN
VPM1 T3 ON T2.DocEntry = T3.DocNum
where T0.DocDate >= '[%0]' and T0.DocDate <='[%1]'
group by T0.DocStatus,T0.DocDate ,
T0.DocNum ,
T0.NumAtCard,
T0.TransId ,
T0.Comments ,
T0.CardCode,
T0.CardName ,
T0.WTSum ,
T3.DueDate ,
T3.CheckSum
Thanks & Regards,
Nagarajan -
Converting a Hexadecimal String to a Binary String
Hello NG,
I would like to convert an 8 Bit Hexadecimal String (example C0034000)
to it´s equivalent in binary (in this case---> 1100 0000 0000 0011...
and so on), I didn´t find any possible way to do this. I´am not
talking about the simple representation on the front pannel. Some
Postings say that this ist possible with the "Format Value" Function
adding an "%b" to the entring, but in my case it does not function.
Could someone help me, thanks in advance!> I would like to convert an 8 Bit Hexadecimal String (example C0034000)
> to it´s equivalent in binary (in this case---> 1100 0000 0000 0011...
> and so on), I didn´t find any possible way to do this. I´am not
> talking about the simple representation on the front pannel. Some
> Postings say that this ist possible with the "Format Value" Function
> adding an "%b" to the entring, but in my case it does not function.
The task here is to convert a string to a different string. The easiest
way to do this is to convert the string to a numer, then format the
number as a binary string.
On the string palette the Scan from String using %x can be used to
change a hex string into a numeric integer. The Format to String with
%b and other nodes can take a numeric i
nteger and return a string of
binary characters. These two nodes wired together with the correct
constants should do what you want.
Greg McKaskle -
Converting String to unicode encoded string
Hi,
I would like to convert non-ascii characters in a String or the whole string to unicode encoded character.
For example:
If i have some japanese character, I would like it to be converted to /uxxxx
How can i do this? I don't want the exact character, as I am able to get that using getBytes("encoding format"). All i want is code point representation of the non ascii unicode characters.
Any help to do this will be appreciated.
Thanks in advance.I tried to do what that but I am not sure whether that is right or not.
String inputStr = "some non ascii string";
char[] charArray = inputStr.toCharArray();
int code;
StringBuffer sb = new StringBuffer();
for(int i = 0; i < charArray.length; i++)
code = (int) charArray;
String hexString = Integer.toHexString( code );
sb.append(hexString);
System.out.println("Code point is "+sb.toString());
My above code does not work as expected. Could you please tell me where i am goofing?
Thanks! -
Converting Oracle XML Query Result in Java String by using XSU
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
ThanksHmmm.. Pretty basic just look at the example:
OracleXMLQuery qry = new OracleXMLQuery(conn,"Select max(ps.datum) from preise ps where match='"+args[0]+"'");
String xmlString = qry.getXMLString();
Hi,
I have a problem by converting Oracle XML Query Result in Java
String by using XSU. I use XSU for Java.
For example:
String datum=new OracleXMLQuery(conn,"Select max(ps.datum) from
preise ps where match='"+args[0]+"'");
String datum1=datum;
I become the following error:
Prototyp.java:47: Incompatible type for declaration. Can't
convert oracle.xml.sql.query.OracleXMLQuery to java.lang.String.
Can somebody tell me a method() for converting to solve my
problem??????
Thanks -
Passing strings to a LAbVIEW application from Visual-C++ using ActiveX
Hello all,
I have built a LabVIEW application with ActiveX server enabled. I can
start the application, and can read and set simple control values like
numerics.
But now I want to pass (SetControlValue) strings and read (GetControlValue) strings from controls.
After searching a whole day for examples or HowTos I found nothing. Can
anyone give me tip where I can find something about that?
Examples are also appreciated.
Best regards
Heinrich EidlothThe problem you are running into is that a BSTR is not a normal string (%s in the printf), but a wide character string (i.e., two bytes per character) string with the size stored in it. If the string contains ASCII characters, such as Hello World, then the one of the bytes per character is 0 (for example, 'H' would be 0x48 0x0).
When printf sees this, it thinks that it is a normal, null terminated string of "H". That is what you are seeing. You might try the %S (capital S) since that tells it the string is a wide character string.
Also note that BSTR's are part of the COM (Automation) system and so are don't freed with a delete or free() statement. Instead you need to release the memory with a SysFreeString() call.
If you aren't very familiar with C/C++, then you've taken on an advanced topic on top of a complicated language. If you can, you might want to try using either VB6 or .NET (C# or VB.NET). Those languages handle all of this for you automatically and you don't have to worry about freeing the memory.
If not, the book I started with to learn COM programming was this one (http://www.amazon.com/gp/product/1572313498/104-3574382-6511132?v=glance&n=283155&n=507846&s=books&v...).
Brian Tyler
http://detritus.blogs.com/lycangeek -
LabView String StartsWith functionality like in C#?
Hello all,
in C# (.NET) there is a good class: String
There it is possible e.g. to get information, if the string startswith a special substring.
Is there such possibility in LabView? Is there such LabView vi, which offers this functionality? (Some snippet?)
Why I am asking:
I want to create a switch/case-block (case-structure) in labview for this code:
if(string.startswith("XYZ")) step into case1
else if(string.startswith("DEF")) step into case2
BTW:
It would be so nice if anybody could create polymorphic VI with these functions:
(from C# string class)
public object Clone();
public static int Compare(string strA, string strB);
public static int Compare(string strA, string strB, bool ignoreCase);
public static int Compare(string strA, string strB, StringComparison comparisonType);
public static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture);
public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options);
public static int Compare(string strA, int indexA, string strB, int indexB, int length);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options);
public static int CompareOrdinal(string strA, string strB);
public static int CompareOrdinal(string strA, int indexA, string strB, int indexB, int length);
public int CompareTo(object value);
public int CompareTo(string strB);
public static string Concat(IEnumerable<string> values);
public static string Concat<T>(IEnumerable<T> values);
public static string Concat(object arg0);
public static string Concat(params object[] args);
public static string Concat(params string[] values);
public static string Concat(object arg0, object arg1);
public static string Concat(string str0, string str1);
public static string Concat(object arg0, object arg1, object arg2);
public static string Concat(string str0, string str1, string str2);
public static string Concat(object arg0, object arg1, object arg2, object arg3);
public static string Concat(string str0, string str1, string str2, string str3);
public bool Contains(string value);
public static string Copy(string str);
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count);
public bool EndsWith(string value);
public bool EndsWith(string value, StringComparison comparisonType);
public bool EndsWith(string value, bool ignoreCase, CultureInfo culture);
public override bool Equals(object obj);
public bool Equals(string value);
public static bool Equals(string a, string b);
public bool Equals(string value, StringComparison comparisonType);
public static bool Equals(string a, string b, StringComparison comparisonType);
public static string Format(string format, object arg0);
public static string Format(string format, params object[] args);
public static string Format(IFormatProvider provider, string format, params object[] args);
public static string Format(string format, object arg0, object arg1);
public static string Format(string format, object arg0, object arg1, object arg2);
public CharEnumerator GetEnumerator();
public override int GetHashCode();
public TypeCode GetTypeCode();
public int IndexOf(char value);
public int IndexOf(string value);
public int IndexOf(char value, int startIndex);
public int IndexOf(string value, int startIndex);
public int IndexOf(string value, StringComparison comparisonType);
public int IndexOf(char value, int startIndex, int count);
public int IndexOf(string value, int startIndex, int count);
public int IndexOf(string value, int startIndex, StringComparison comparisonType);
public int IndexOf(string value, int startIndex, int count, StringComparison comparisonType);
public int IndexOfAny(char[] anyOf);
public int IndexOfAny(char[] anyOf, int startIndex);
public int IndexOfAny(char[] anyOf, int startIndex, int count);
public string Insert(int startIndex, string value);
public static string Intern(string str);
public static string IsInterned(string str);
public bool IsNormalized();
public bool IsNormalized(NormalizationForm normalizationForm);
public static bool IsNullOrEmpty(string value);
public static bool IsNullOrWhiteSpace(string value);
public static string Join(string separator, IEnumerable<string> values);
public static string Join<T>(string separator, IEnumerable<T> values);
public static string Join(string separator, params object[] values);
public static string Join(string separator, params string[] value);
public static string Join(string separator, string[] value, int startIndex, int count);
public int LastIndexOf(char value);
public int LastIndexOf(string value);
public int LastIndexOf(char value, int startIndex);
public int LastIndexOf(string value, int startIndex);
public int LastIndexOf(string value, StringComparison comparisonType);
public int LastIndexOf(char value, int startIndex, int count);
public int LastIndexOf(string value, int startIndex, int count);
public int LastIndexOf(string value, int startIndex, StringComparison comparisonType);
public int LastIndexOf(string value, int startIndex, int count, StringComparison comparisonType);
public int LastIndexOfAny(char[] anyOf);
public int LastIndexOfAny(char[] anyOf, int startIndex);
public int LastIndexOfAny(char[] anyOf, int startIndex, int count);
public string Normalize();
public string Normalize(NormalizationForm normalizationForm);
public string PadLeft(int totalWidth);
public string PadLeft(int totalWidth, char paddingChar);
public string PadRight(int totalWidth);
public string PadRight(int totalWidth, char paddingChar);
public string Remove(int startIndex);
public string Remove(int startIndex, int count);
public string Replace(char oldChar, char newChar);
public string Replace(string oldValue, string newValue);
public string[] Split(params char[] separator);
public string[] Split(char[] separator, int count);
public string[] Split(char[] separator, StringSplitOptions options);
public string[] Split(string[] separator, StringSplitOptions options);
public string[] Split(char[] separator, int count, StringSplitOptions options);
public string[] Split(string[] separator, int count, StringSplitOptions options);
public bool StartsWith(string value);
public bool StartsWith(string value, StringComparison comparisonType);
public bool StartsWith(string value, bool ignoreCase, CultureInfo culture);
public string Substring(int startIndex);
public string Substring(int startIndex, int length);
public char[] ToCharArray();
public char[] ToCharArray(int startIndex, int length);
public string ToLower();
public string ToLower(CultureInfo culture);
public string ToLowerInvariant();
public override string ToString();
public string ToString(IFormatProvider provider);
public string ToUpper();
public string ToUpper(CultureInfo culture);
public string ToUpperInvariant();
public string Trim();
public string Trim(params char[] trimChars);
public string TrimEnd(params char[] trimChars);
public string TrimStart(params char[] trimChars);
Eugen Wiebe
Bernstein AG
CLAD - Certified LabView Associate Developer
Solved!
Go to Solution.Why I am asking:
I want to create a switch/case-block (case-structure) in labview for this code:
This can be done already with the case structure, you can do simple parsing in the case selector, which takes a string as an input.
Type into the case for first case "XYZ....XYZ~"
Type into next case "DEF...DEF~"
Next case is empty string, default.
How does this work:
The "XYZ...XYZ~" matches all strings that start with XYZ and have any ascii value after the ~ is the highest printable 7bit ascii value so this catches all other characters.
Option 2 is parse (there are very good reg expression vi in the string palette) the string and create interger value if a matched then habdle the unique integers in the case structure.
There are so many ways to do it without making a wrapper for the .net string class, I provided a few quick methods
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA -
Problem in reading data from Excel sheet to 2D string array (ActiveX & LabView).
I am trying to read data from Excel sheet to 2D string array (ActiveX & LabView). Error -2147352571 is generated (type mismatch) if cell value is "#NULL!", "#N/A" etc. What should I do?
Hello �
Is the error happening when the cell value is #NULL or #NA only?
Sometimes these errors occur because of an ActiveX object mismatch. The version of the ActiveX object might have changed or been updated since the VI was created. The VI tries to use an earlier, incompatible version of the ActiveX object.
To solve the problem, you need to link automation refnum terminal to the correct ActiveX object. To do so, right-click an automation refnum terminal and choose Select ActiveX Class»Browse from the shortcut menu. From the Type Library pull-down menu, select the latest version of the library you want to use, such as Microsoft Excel Object Library. In the Objects list, select an ActiveX object, and click the OK button. Link ea
ch automation refnum terminal in the VI and its subVIs until the run arrow is not broken. Also, you might have to replace some or all of the Invoke Nodes and Property Nodes for the ActiveX objects.
Also, I came across this Knowledgebase. The error number is slightly different but it is always good to check it out and make sure it is not your case.
Hope this helps.
S Vences
Applications Engineer
National Instruments
Maybe you are looking for
-
Can I share an iTunes account with multiple devices?
I had an iPhone 3GS. Just upgraded to an iPhone 5C. I'd like to save the 3GS for our daughter to use as an iPad Touch. I realize that I'll need to wipe the 3GS clean and start over with new apps for her. I have a few questions: Can I use my same iTun
-
Export word to pdf and maintain font color inside tables
Hello, I'm strugling with producing a PDF from Word document and keep the red colored text inside excel tables that are on the Word document. From excel I copy the tables to Word 2007, with "Paste special --> Paste link as Microsoft Office Excel 2003
-
How to find system status for production orders?
How to find system status for production orders? looked into table AUFK, AFKO and AFVC but none of these tables, carry system status as part of the fields(STTXT) I tried to filter in COOIS, but not much help Able to find system status information in
-
MATMAS05 IDOC adding Quality Management view to Material when posted
Matmas05 IDoc when posted is appending Quality Management(QM) view to material. Initially Material doesnt have a QM view . However whil e postion matmas05 , MAra-VPSTA & PSTAT fields are getting updated with the letter Q(which is QM). I'm not passing
-
Problem downloading from adobe site PS
my system crashed had it rebuilt with windows 7 - went to adobe site to download cs4 and LR - was told to download smaller file first so did. then went to the double and tried to download part one. i'm getting error message "the file archive part of