string

String/Sequence Patterm Mining ! not matching !

Hi , it's a week i'm trying to find an answer for my question , i would appreciate if anyone can help . I've got a list of strings(originally list of sequences which can be viewed as list of strings) and i'd like to find a pattern (which is a string itself) withtin strings of this list , is there any java library which can i use or is t...

os.path.exists not accepting variable input

Whenever I call os.path.exists(variable) it will return false but if I call os.path.exists('/this/is/my/path') it will return true. import os import sys test = None print("Test directory") test= sys.stdin.readline() test.strip('\n') print(os.path.exists(test)) I know that os.path.exists can return false if there is a permissions erro...

Generate random string from 4 to 8 characters in PHP

Hi guys!! I need to generate a string using PHP, it need to be unique and need to be from 4 to 8 characters (the value of a variable). I thought I can use crc32 hash but I can't decide how many characters, but sure it will be unique. In the other hand only create a "password generator" will generate duplicated string and checking the v...

Javascript / Jquery - Get number from string

Hi the string looks like this "blabla blabla-5 amount-10 blabla direction-left" How can I get the number just after "amount-", and the text just after "direction-" ? ...

How do I split a string at an arbitrary index?

How can I split up a string into pieces? For example, how can I place "orld." into a variable called one, "Hello" into a variable called three, and " w" into two? #include <string.h> #include <stdio.h> int main(void) { char *text ="Hello World."; /*12 C*/ char one[5]; char two[5]; char three[2]; return 1; } ...

What's an easy way to get the url in the current window minus the domain name?

My Javascript ain't so hot, so before I get into some messy string operations, I thought I'd ask: If the current url is: "http://stackoverflow.com/questions/ask" What's a good way to to just get: "/questions/ask" ? Basically I want a string that matches the Url without the domain or the "http://" ...

Javascript Split, change parts number

I have a dynamically generated large string witch I am splitting. var myString="val1, val, val3, val4..... val400" I do a simple split on this string: myString= myString.split(',') getting the following: myString[1] // gives val1 myString[2] // gives val2 myString[3] // gives val3 . . . myString[400] // gives val400 Is there a w...

C++ TCHAR[] to string

Hello everyone I have this method which receives a path through a TCHAR szFileName[] variable, which contains something like C:\app\...\Failed\ I'd like to sort through it so I can verify if the name of the last folder on that path is in fact, "Failed" I thought that using something like this would work: std::wstring Path = szFileNam...

Convert.ToDatetime not adding timestamp

For example: Dim testdate As String = "29/10/2010" testdate = Convert.ToDateTime(testdate.ToString) Response.Write(testdate) expecting "29/10/2010 00:00:00" what I get is "29/10/2010" ...

C++ tstring compare

hello again I have this variable dirpath2 where I store the deepest directory name of a path: typedef std::basic_string<TCHAR> tstring; tstring dirPath = destPath; tstring dirpath2 = dirPath.substr(destPathLenght - 7,destPathLenght - 1); I want to be able to compare it it another string, something like: if ( _tcscmp(dirpath2,failed)...

Ruby 1.9 Array.to_s behaves differently?

i wrote a quick little application that takes a base file of code with some keywords, a file of replacements for the keywords, and outputs a new file with the keywords replaced. When i was using Ruby 1.8, my outputs would look fine. Now when using Ruby 1.9, my replaced code has the newline characters in it instead of line feeds. For e...

Is this code too brittle?

I need to create a strategy pattern where a user selects four strategies from a list of twenty or thirty unique strategy objects. The list of strategies will be expanded as the project matures, and users can change their selected strategy at any time. I plan to store the strategy names they have selected as strings, and then use a meth...

I'm new to python and having trouble with this looping code

Hey gurus, I'm trying to copy sections in a file within a set of XML tags > <tag>I want to copy the data here</tag>` Please note I found out the data around the tags is not valid XML so I can't import a normal library and have to find it via string comparison :( * There are multiple sections of text I want to extract in the file...

How to count string length of a domain list and group them by length?

I have a list of domain names, for example: domain1.com domain2.com domainxxx2.com dom.com from that list I want to get: length 7 [2] length 10 [1] length 3 [1] I know how to split the tld and count each domain length, but dont know how to group and count those with the same length. I would like to do it on PHP. ...

More optimized solution, find number of substrings in a string. Using C.

Hi All, So, I have a task to find number of substrings in given string. I can't use any C libraries for doing this task. stringExist can only have 2 strings as a parameters. My solution is working, but I have a feeling that there should be a more elegant way to do this task. Solution 1: as it turns out, it doesn't work correctly #incl...

insert string info into addressing a movieclip in as3?

I am trying to dynamically address different instances of the same movieclip by passing a string into the movieclip address, but apparently I don't know what I'm doing. I'm trying something like below: var vsTargetName:String; vsTargetName = "instance50"; vsTargetName + vsThumb.thumbHighlight.visible = true; Is something like this pos...

String numbers into number numbers in PHP

Hi Guys, How come when I set 00 as a value like this: $var = 00; it ouputs as 0 when I use it? How can I set 00 so that $var++ would become 01? ...

String number into number in PHP

Hi Guys, Say I have a string like John01Lima is there any way to pull out the two numbers and have them as numbers that can be incremented with $number++ ? ...

Android - fix TextView width by string

Hi, I think the answer to this question is probably so simple, but I'm struggling.... I have a TableLayout with multiple columns. I want the last column to be of a fixed width, but I want to define that width to just be able to hold the widest possible string from my program. i.e. it is always wide enough to contain "THIS STRING" witho...

[Java/Android] Problem with String equals() returning false (custom Comparator involved)

Hello, I built a very simple custom Comparator, that I use with a TreeSet in order to sort Strings by length in that TreeSet. I'm having trouble finding the reason why (s1.equals(s2)) returns false even when the two strings s1 and s2 contain the same value... Eclipse "variables view" shows the letters are the same in both strings, but...