If String Contains String Pattern Return Value

May 4, 2010

I am struggling to extract a 'matched' string and wonder if I am missing something simple.Let's say my code finds a string 'abcdefgh -john. smith 1234567 a123-a-123-f the last search, abc, 123 ;'I am searching this string for the pattern '[a-z]###-[a-z]-###-*'I know this text appears in the string as 'a123-a-123-f'I would like to be able to return the matched string value 'a123-a-123-f' to a variable.If I place a wildcard * in front of the pattern, it will find the text, but obviously everything else in front of it, is there a way that somebody can think of to strip the variable without using the preceding wildcard?I am not worried about the wildcard on the end of the string as I can strip back to the last space.[code]

View 3 Replies


ADVERTISEMENT

.net - Function To Accept List(Of String), Array & String And Similarly Return List(Of String)?

Jul 29, 2011

I want the Function to accept List(Of String), Array & String and similarly return List(Of String), Array & String respectively. The Function simply adds a string (month) to the input collection. I just want to use it for string, array and list with needing to think of conversions.

[Code]...

View 2 Replies

.net - Can't Return Dictionary(Of String, String) Via GET Ajax Web Request, Works With POST

Jun 23, 2009

I have the following web method:

<WebMethod()> _
<ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True, XmlSerializeString:=True)> _

[Code].....

I wanted to use HttpGet here so that the result can be cached.

I tried every variation of calling this, but no luck. Is this possible with GET?

View 2 Replies

Looking For Pattern In A String?

Mar 21, 2012

How would I remove an alpha-numeric sub string in a string that meets these rules:

J111DD
L###LL
l = Leter
# = Number

View 1 Replies

Search String For Pattern?

Jul 6, 2010

Is there a way to search for a string pattern in a string ?

i have 1000 of strings and example of one is - 'won 2 races in town, 1998, and then moved to'i wish to search for the ", ####," as all the strings are in the same format (note that the year is different every time hence why not using the instr)

View 2 Replies

C# - Finding A Repeating Pattern In A Given String?

Jan 4, 2012

I have a networkstream (using C#/VB.NET). while on reading values coming like this:

&% 68 kg K A&% 23 kg K A&% 174 kg K A &% 68 kg
&% 34 kg K A&% 2334 kg K A&% 68 kg K A &% 68 kg K A
&% 2348 kg K A&% 78 kg K A&% 28 kg K A&% 68 kg

The numerical(weight) value will be continuously varying.

Every time i am reading the starting of the stream differs. But the pattern remains the same. How to split that into '&% 78 kg K A' which represents one set.

How to extract the weight value from this stream using Regex or any other methods?

View 1 Replies

DateTime Format String Pattern

Jul 28, 2011

Could someone please guide me on the correct format string to display a time in the following format? [code] Is there one format string I can use to accomplish this?

View 3 Replies

Finding Pattern Without String Array?

Nov 14, 2011

Im trying to make an on access file scanner, YES I know that C++ is better, but this is a concept of thought, trying to challenge myself to see if its possible in vb.

Anyways, I have a list of Hex definitions, my question is, how can I index this list so I can access the definitions faster. A definition looks like this:

Eicar.Test.File.a=58354f2150254041505b345c505a583534285

The part after the equals sign is the HEX signature, while the first part is the name of the definition.

Basically what I am trying to do is index them somehow where I can scan faster, as I have over 60,000 definitions and I have to split each individual one in order to get the signature name. It takes about 45 seconds or so to scan a 500KB file. I need it to be WAY faster.

View 1 Replies

RegEx - Finding Pattern In String

Jul 22, 2009

I'm trying to find a pattern in a string, I guess is very easy but I'm terrible in regular expressions. I have a big text and I need to find all the next type of pattern:
{a|b|c}
That can be also something like this: {a|b|c|s|f|f|ft|r} or any number of items inside but at least 2 items so the pipe symbol is another key. Is this an easy regular expression? I'm using vb.net 2005.

View 4 Replies

VS 2010 Repeated Pattern In String?

Jun 19, 2012

I am trying to parse a string that contains known and unknown characters.here is an example:

[1]Tue Jun 19 17:14:15 2012, 48:17:4C:00:00:74, 4.8, 5449,816324, 26, 31397, 160855, 30775030, 29962782, 812248, 2394476, 71619, -44, -67, 46, -60, 51, 0, 86468, 2547055, 4687358, 44278, 4593, 65076, 65191, 65106, 65166, 65108, 64552, 64572, 64512, 5.1, 2548502, 4690906, 520, 0, 0, 0, 36, 2412

[code].....

The known part is the [0] or [1] or whatever number in the brankets.the unknown part is the rest of the message.So if i have this string i want to cut it to smaller substrings that start with [ and end before the next [ .To make it more tough, sometimes, before the next [ there is another message that comes like: Jun 19 17:13:40 2012 timestamp And after that it continues with the next [

View 10 Replies

C# - Proxy Pattern - Serialize A Class Into A String

May 10, 2011

I need to be able to serialize a class into a string, and I know of 2 patterns:

1) (normal) Serialization pattern

2) Proxy Serialization pattern

I've read [URL] (the only website in google that talks about the proxy-serialization pattern) and still cant find the advantage or benefit of using this pattern. Could someone explain what exactly is the proxy serialization pattern, or rather exactly what problem does the proxy-serialization pattern solves that the normal-serialization pattern doesn't solve?

View 1 Replies

Search For A String Pattern In A Binary File?

Oct 26, 2010

I want to search for a String Pattern in a Binary File (Binary File is not 100% plain text). Here is the pattern:

"**_*_*_*"
or
"111_11_11_112"

View 7 Replies

Return A String From C++ Dll To VB

May 27, 2011

How can I return a string from c++ dll to VB? I want to return a string through return value, not param.So many times, googling but i couldn't find the solution.Here is my sample code, but when the function(testBSTR()) is called,the sample program is crashed.[code]

View 4 Replies

C# - Return Only Digits 0-9 From A String?

May 10, 2009

I need a regular expression that I can use in VBScript and .NET that will return only the numbers that are found in a string.

For Example any of the following "strings" should return only 1231231234

123 123 1234
(123) 123-1234
123-123-1234

[Code]....

View 5 Replies

Return A String From A Function

Jun 27, 2012

I have a class in this class i call a function which should return some string the class connects to an ftp server and list the directory and returns the filenames of the dir.

Code:

Public Function GetFileList(ByVal host As String, ByVal username As String, ByVal password As String, ByVal currentdirectory As String) As List(Of String)
Dim oFTP As FtpWebRequest = CType(FtpWebRequest.Create(host & currentdirectory),

[CODE]..........

So this should return all filenames of that directory

like:

Data1.xml

Data2.xml

Data3.xml

Now i have a form with a listview where i want to call this function and get the files of the "olist"

Code:

Return oList

HOW CAN I DO THAT? i mean how would my sub look like on my form where i want to call that function?

View 2 Replies

Return String From C++ Function?

Nov 8, 2011

I am trying to call C++ function from VB.Net code which returns string using PInvoke, but it is returning only single character.

C function Declaration
extern "C" __declspec(dllexport) LPSTR Get_GetDescription(HANDLE)
C function Defination
LPSTR Get_GetDescription(HANDLE resultBreakDown){

[Code].....

View 1 Replies

Should This Really Return An Empty String()?

Nov 26, 2010

I have an attribute class:

[code]...

With that said, shall the Private Property Attributes() As String() not return the values of DirectoryAttribute placed over the interfaces properties as well, since I specify True in the inheritance parameter of the Type.GetCustomAttributes method?

View 1 Replies

.net - What To Do When Dll Return A String Not Correctly Terminated

Mar 10, 2009

I have an third part dll that have a function that returns a string.When I call the function I got for example "123456" back. At least it seams like that, but when i do mystring.length it does not return any length. If I set the text property of a label it shows "123456".

When I have the string I got from the dll I send it to a webservice function:

rem call dll and get string
dim mystring as string=mydll.getstring()
rem Send it to the webservice
webservice.SaveString(mystring)

The webservice crashes with an webexeption ("protocoll error") when I send in the string I got from the dll. If I instead send it like this:

rem call dll and get string
dim mystring as string=mydll.getstring()
rem Send it to the webservice
dim FixedString as string = mid(mystring,1,6)
webservice.SaveString(mystring)

Then it works and everything is fine. That leads me to think that the string I got from the DLL is in someway not terminated correct.And I dont know how to fix it from vb.net (I cant change the DLL)and I dont know in beforehand how long the string will be.The dll does only work on site when specific hardware is connected so I can't sit at the office trying to fix this in dev-environment. So I would like to have some possibly solutions to this before I go to the customer again.

Edit 1:I tried to just do a loop that looped from 1 to 100 (because I dont know the real length) and tried to copy all characters that <>"" to a new variable but it didnt work. I didnt try other variants because the day was over and I had to leave the customer site.

Edit 2:The DLL Im talking to is made in VB6. That DLL is talking to other DLLs that is made in C++ (I think).

My program < - > vb6-DLL <-> c++-DLL <-> hardware

View 4 Replies

Pass A String Return An Object?

Feb 12, 2011

I 'm new to programming and to vb. So my question could be from misconception about what can i do. How can i pass a string to a "procedure" and get in return a object whith the same name as the string?

View 8 Replies

Regex To Return Part Of String?

Jun 2, 2011

I have a string (bufferedstring) which contains:

blah blah blah Version V3.5/7(030114) blah blah blah blah

I'd like to parse out the Version V3.5/7(030114) part using a Regex or Substring, but not sure how. The surrounding text could be dynamic in length and the 6 numbers between the parenthesis could be a different length as well (maybe 4).

how would I get just that string out?

View 4 Replies

Remove Carriage Return From String

Feb 5, 2011

I would like to insert the following into a string.[code]I want it to go into a string as follows [code]i.e. without the carriage returns.How do I achieve this?

View 5 Replies

Replace A Carriage Return In A String?

Nov 6, 2009

I have an issue with a string where I pull the field from a table and the field is showing a return character, (shows as a little box).

I know how to replace quotes or other characters in a string.

Question is how do you replace a return or remove it from the string?

View 2 Replies

Return A Certain String Automatically By The Program?

Jul 28, 2009

how to return a certain string automatically by the program to a spicific record in access with visual basic (visual basic 5 or visual studio 2008) .... meaning : i want after the user made a click on an image obgect the program put a word i'e a string to a record in a field in an access table...

View 3 Replies

Return To Start Of A String For Searching?

Feb 1, 2010

I'm sure but can't see the answer. Currently going through a string "DO While Not ts_IN.AtEndOfStream" looking for information. This includes then checking another string (while inside the first) for matching reference point for further data.

So within the first loop, I have a second loop "Do While Not ts_IN2.AtEndOfStream". And looping through that string searching for the reference point.

This works initially, but after awhile don't find anything because it is not going back to the start of ts_IN2 string each time loops on the first section.

View 4 Replies

Trying To Make A Class Return A String

May 18, 2012

I'm moving code from code-behind to classes and run into a problem. I have a method which makes a string (an html invoice). In the method a final amount is created. I want to make a class called Invoice which will have the method "CreateInvoice" which will return a string and I also want to set the finalCharge property of the object.[code]

View 1 Replies

Difference Between Dictionary(Of String, String) And IDictionary(Of String, String)?

Jan 18, 2011

Can I do anything more or less with IDictionary? How do these two collections differ?

View 5 Replies

String Split - Error Value Of Type '1-dimensional Array Of String' Cannot Be Converted To 'String'

Mar 11, 2010

my code is :

[Code]...

The error is Value of type '1-dimensional array of string' cannot be converted to 'String'.

View 2 Replies

.net - Return A String Array From A Function Without Initialising It First?

Dec 10, 2009

Public Function Foo() as String() Dim bar As String = {"bar1","bar2","bar3"}

Return bar End Function

My situation is similar to the code sample above where I'm returning a string array from a function.

What I would like to do is just return the string array without having to declare a variable first and then return the variable.Something like this, although this obviously doesn't work:

Return {"bar1","bar2","bar3"}

Is it possible to do this, I can't seem to find a method that works?

View 2 Replies

Exit Function Or Return String.empty?

Sep 9, 2009

I have the following piece of code: trying to use this in 2.0 framework. getting error for not having a return statement before exit function.[code]...

View 4 Replies

IDE :: String Manipulation - Return Number Infront Of X

May 2, 2009

I have a very simple question: I have a string that may say "3x itemname", or "32x itemname". How do I get it to return the number infront of the x?

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved