Convert A String (EG: "x^2") To An Expression ( EG: X^2)?
Apr 20, 2009I want to convert a string variable into an expression to be evaluate within code. Can this be done?
View 1 RepliesI want to convert a string variable into an expression to be evaluate within code. Can this be done?
View 1 RepliesI'd like to understand why one type can't be converted to another type inside a constant expression.
View 13 RepliesI may have a string for example potato in a vb.net application. I want to find all the occurrences of o and convert them to 0, so the desired out is: p0tat0.I know it can be done by the provided string operations but I need a regular expression in my scenario.
View 1 Replies. I get this error: "Cannot convert lambda expression to type 'string' because it is not a delegate type" - keyword select become underlined in blue
[Code]...
Above code should displays drop list of employees first name and last name in a combo box
I must convert string data from a CNC that is arithmetic expression to a number that I can use in a VB application that I wrote. The following is what I get out of the cnc. [18722*65536+19377]/67108864. I need to evaluate this expression in my VB ap. The format of the string is not always the same as what I have illustrated.
View 2 RepliesThe code you posted while similar to VB6 has method and syntax that is very similar to Crystal Reports Scripting Language
[Code]...
In looking at Fuzzy Date Time Picker Control in C# .NET? Piotr Czaapla's answer to that question is exactly what I need. unfortunately, I'm a VB.NET guy and I'm not that familiar with lambda expresions, so my attempts to convert the code have resulted in hours of misplaced parenthesis and banging my head with a brick.
Any chance some bi-lingual wizard could convert the C# code to VB.net for me?
[Code]...
How should the following C# code be converted to VB.Net? I have tried several code converters and none produce correct results.
[code]...
[QueryInterceptor("Somethings")]
public Expression<Func<Something, bool>> OnSomethings()
{
// Code here
}
I had a view guesses, looked on msdn, but there are no examples matching the way that that is used.
I have the following C# LINQ query expression:
[code]...
how to convert this to VB.NET?
I need a regular expression that can validate that a string is an alphanumeric comma delimited string.
Examples:
123, 4A67, GGG, 767 would be valid.
12333, 78787&*, GH778 would be invalid
fghkjhfdg8797< would be invalid
This is what I have so far, but isn't quite right: ^(?=.*[a-zA-Z0-9][,]).*$
How would you convert this to VB (using .NET 4.0 / VS2010) ?
bw.DoWork += (o, args) =>
{
Code Here
};
I thought maybe like this:
AddHandler bw.DoWork,
Function(o, args)[code]....
But it says Function does not return a value on all code paths.
I've got the following to sort entities by their job position. The desired order ist defined in another array. In C# this code works:[code]However I will have to convert this to VB.net. I read the equivalent would be something like the following:[code]This does not compile, gives me "Expression expected" right after the Function(x). What am I doing wrong?
View 1 RepliesThis is a related to a previous question I have asked here, see the link below for a brief description as to why I am trying to do this.Regular expression from font to span (size and colour) and back (VB.NET).Basically I need a regex replace function (or if this can be done in pure VB then that's fine) to convert all ul tags in a string to textindent tags, with a different attribute value for the first textindent tag.For example:
<ul>
<li>This is some text</li>
<li>This is some more text</li>[code].....
Basically I want the first ul tag to have no indenting, but all nested ul tags to have an indent of 20.
how can I use a string ( string = "my.resources.imagename" ) as an expression? like this:
dim imageString as string = "my.resources." + name 'name will be declared and is the name of the person of who the picture in the resources is picturebox1.image = (expression from string here)
is this possible? if yes, how then? I searched all over the internet but I couldn't find it
Does anybody know of a call in vb.net that will evaluate a string expression. For example, how would one evaluate the expression "(1+2)*(3+4)"?I've looked all over and it seems that people are writing their own parsers. There has to be a better way. After all these years, VB.Net must have something that will take an expression and evaluate it.
Dim strMyExpression as string = "(1+2)*(3+4)"
msgbox( VBEvaluate(strMyExpression))
and the result would be 35.Also, when will microsoft start to use google as the search engine for these forums? Bing really sucks. Searching for "Evaluating a string expression in VB.net" gives the most bizarre links.
im doing a simple calculatro and was happy with the way i done things .. a ew member variables and a properties:
Private MVAR_Number1 As Decimal
Private MVAR_Number2 As Decimal
Private MVAR_Operator As Char[code].....
he want to add this:
Dim Operators() As Char = ("+", "-", "*", "/")
Dim OpPos as Decimal
OpPos = Expr.IndexOfAny(Operators)[code].....
Just drives me mad how complex this is all getting for something so simple, fell like giving it all up .
I have like a three word expression: "Shut The Door" and I want to find it in a sentence. Since They are kind of separated by space?
View 6 RepliesI have a application that allows the user to enter a series of nested filtering commands. E.g "Name starts with x or ((Description contains y or Property1 is On) and Property2 > 100)"
I can preprocess this and distill it down to a string in the form of an expression of True and False's ie, To "True or ((False or True) and False)" Is there a simple way to have this final expression evaluated without having to write a complex evaluator myself?
I have seen a method of evaluating this by compiling a dummy function at runtime but as I need to process this against possibly thousands of records that solution is too slow.
BTW These are not all fields in a database so I cannot use Queries or SQL etc.
Is there a method that allows me to evaluate a mathematical expression in a string? Example (Not actual Code):
Input = "2+2"
Output = SomeMethod(Input)
Output = 4
Update: Nevermind, I found a way around it by using DataTable.Compute.
I want to match a string for example "yes" but where it is not in brackets so that the following would be matched: yes (bla yes bla) bla yes
View 7 RepliesI want a regular expression for the following issue:I want to match a string that contains A,B,C,D,E and F. string length should be 0 to 6. and not character should be repeat in the string.Example: ABCDEF, ACDEFB, EFBCDA, etc. but not ABBCDES/W Engineer
View 3 Repliesfrom the Help in VS 2008: Replace: Returns a string in which a specified substring has been replaced with another substring a specified number of times.
Expression
Required. String expression containing substring to replace.
Find
Required. Substring being searched for.
Replacement
Required. Replacement substring.
Start
Optional. Position within Expression where substring search is to begin. If omitted, 1 is assumed.Count Optional. Number of substring substitutions to perform. If omitted, the default value is 1, which means "make all possible substitutions."
Compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings for values.
[Code]...
In a Select Case statement is there a way to test if an expression contains a part of a string? Something like this:
Select Case myString
Case "*abc*" 'any string that contains "abc" falls here
Case "*def*" 'etc
End Select
I understand the concept of regular expressions but I am looking for a regular expression string that checks the input string for the following criteria only...
1.) Upper and lower case letters
2.) The space character
3.) Apostrophe
4.) Comma
5.) Period
6.) Hyphen
Ok - this may seem like a strange request ... but basically I need a regular expression to return a string in between two brackets as described below... String:
[Code]....
I am trying to use a regular expression to find a certain string within a textbox.
Is it possible to include the equals sign (=) within the regex so it looks for this? When i type the equals sign within the regex it doesn't fnid it any more.
Works when searching this string - "and JobID 816138</Detail>":
[Code]....
ok, For the moment I have a string() where each element is in the structure of
[Code]...
I am making a simple calculator that will evaluate functions I have a entry box and the user types in simple equations i.e. 1+4*3/5=? how would i make this evaluate the string?
View 7 RepliesHow do I make a regular expression to find a substring within a string that looks like: |sdrt446-7fdfs23| ? The number of characters and types change. So I need whatever in within the | |.
View 3 Replies