Hello ! I have a task that is difficult for me to handle. The task is: Create recursive function that can be generate a string of length N (N <= 100), formed by the letters 'A', 'B' and 'C' and does not containing two identical adjacent substring. For example: enter for N = 6 and the program should generate such a string in which no one else to repeated substrings: ABACAB. Wrong strings are: **AA**BACA - because 'A' is to 'A'; A**BCBC**A - as 'BC' is to 'BC' and **ABCABC** is also wrong because 'ABC' is to 'ABC'. I made …

Member Avatar
Member Avatar
+0 forum 2

Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a working algorithm that avoids transforming the first string into a list of characters. My first idea is to choose a random unicode character, then if it is a substring of string A, choose a random string B of 2 unicode characters. Again if it is in string A, choose a new random B with 3 characters, etc. If somebody sees a working deterministic algorithm, it would be a great idea.

Member Avatar
Member Avatar
+0 forum 16

Hello All, I am facing a problem coming up with a SQL query for a certain issue: Table 1 ------------------- Client ID|Name of Client|Customer Type|Account Type| 01| A | AB | 30 | 02| B | AB | 30 | 03| C | CD | 30 | 04| D | CF | 40 | Table 2 ----------------- Argument|Switch| AB30 | Y | CD30 | N | CF40 | Y | Table 3 ------------------- ClientID|Name Of Client|External_Information| 01|A | External A 02|B | External B 03|C | External C Currently, I am trying to extract the information based on 3 different …

Member Avatar
Member Avatar
+0 forum 1

select SUBSTRING('hello 世田谷区経堂世田谷区経堂 ',5,10) as Japanese gives output as "o ????????". Is there any way i can get the substring of above string ? Thanks in advance for your help.

Member Avatar
Member Avatar
+0 forum 6

Hello people :) Having some difficulties regarding a simple substring. Then length of my line is 52 and I iterate it without any problems. When I use this untill the 22nd character it is working final String articleNumber = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 0, 22)); If I want to pass over the 22nd character, everything stops, empty. Take a look at the StackTrace screenshot...can you figure it out why it is not working ? ![488afabad01fca57105183078113085f](/attachments/large/2/488afabad01fca57105183078113085f.png "488afabad01fca57105183078113085f") final String articleNumber = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 0, 22)); final String articleManufacturer = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 22, 4)); final String descriptionNumber = StringUtils.trimToEmpty(StringUtils.substring(lineValue, 26, 9)); Thank you!

Member Avatar
Member Avatar
+0 forum 4

how to `.replace()` the `'error'`? only use `a` and `b` var str = 'bla bla anything error anything bla bla'; var a = 'anything', b = a; im not good with regular expressions so im asking for how to do this with variables so i can set them up all by myself

Member Avatar
Member Avatar
+0 forum 8

I wrote this code to find if string s2 is a substring of string s1. However I'm getting time limit exceeded. How can I make my algorithm better? #include<stdio.h> int main() { char s1[20], s2[20]; scanf("%s %s", s1,s2); char *p, *q, *count; p=s1; q=s2; int i=21; do{ if(*p==*q) /* the strings are compared */ { count=p; while(*p==*q) {(*p)++; (*q)++;} if(*q=='\0') { i=0; while(&s1[i]!= count) /* count =p to get the index where the substring match starts */ i++; printf("%d",i); break; } else { q=s2; (*p)--;} } } while((++(*p))!='\0'); if(i==21) /* if s2 is not a substring print -1 */ printf("-1"); …

Member Avatar
Member Avatar
+0 forum 2

Hi all. What im trying to accomplish is to get strings from within a string. These strings are seperated with "//*//" an example would be String ExampleString = ("//*//helle//*//goodbye//*//1965//*//this is an example//*//the end"); then I would like to seperated into seperate strings. hello goodbye 1964 this is an example the end Any help in order to accomplish this would be greatly appreciated.

Member Avatar
Member Avatar
+0 forum 4

I want to show only first 50 lines of the $name of the player using string. I used substring but its not work for me. Can anyone edit the code and show only first 50 lines of name. Thanks for the help.... <?php include('config.php'); $tbl_name="players"; // Table name $sql="SELECT * FROM $tbl_name ORDER BY id DESC LIMIT 0,6"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ echo "<li><a style=\"text-decoration:none\" href=\"playerslist.php?id=" .$rows['id']. "\">" .$rows['name']. "</a></li>\n"; } ?>

Member Avatar
Member Avatar
+0 forum 4

How to read a specific value from a text file and then save the value in another text file. Example: in data.txt file there is some values. Item Name : m-01 Item Brand : One Man Item size : XXL Item Price : 1000 Item vat : 15% these are the data saved in data.txt Now my program will ask for the item name and when I will write the item name(ex:m-01) It will just take the values 1000 ( price ) and 15 (vat) and then will save them in a new txt file data2.txt How can I do …

Member Avatar
Member Avatar
+0 forum 12

I have a table with product codes, the first two chars of the product code is the product group. using the product group I'd like to test the content of certain data. Would this be proper coding or is there a better way ? if prodcust_code[:2] == "AB" do: ABsubroutine if prodcust_code[:2] == "CC" do: CCsubroutine if prodcust_code[:2] == "EF" do: EFsubroutine if prodcust_code[:2] == "US" do: USsubroutine

Member Avatar
Member Avatar
+0 forum 2

Hi guys, well my question is the following: I am using XPATH in php. Let me say I have the following in a HTML file: <p>This part I want but not this part</p> I want to have the text "This part I want". I did research and have the following XPATh-rule: //html/body//*[substring-before(.,'but not this part')] My result is that I every time get the text: This part I want but not this part. Does anyone know why? I don't get it. How can I have the text which I want? Regards, Clodan

Member Avatar
+0 forum 0

Hello, I have created a program where a user can input a recipe, and then press a button and this will then be written to a file. On the other side of the interface, the user can select this previously saved recipe and the contents will be read from this Notepad file. I am now trying to create a code that allows the user to recalculate the quantities but I need a substring. When read from the file, the listbox is filled with something like the following: 150, Flour, Grams 150, Sugar, Grams Is there any way to do this? …

Member Avatar
Member Avatar
+0 forum 12

I have my `$arr` of key value pairs like this: array(7) { ["No"]=> string(6) "101" ["Paper_id"]=> string(6) "WE3P-1" ["Title"]=> string(80) ""An Electrically-Small, 3-D Cube Antenna Fabricated with Additive Manufacturing"" ["Author"]=> string(13) "NassarIbrahim" ["Auth_order"]=> string(9) "WE3P-1-01" ["Aff_list"]=> string(51) ""University of South Florida, Tampa, United States"" ["Abstracts"]=> string(723) ""This paper presents the design of an electrically small"" } array(4) { ["Author"]=> string(12) "WellerThomas" ["Auth_order"]=> string(9) "WE3P-1-02" ["Aff_list"]=> string(51) ""University of States"" ["Abstracts"]=> string(2) " " } array(7) { ["No"]=> string(3) "104" ["Paper_id"]=> string(6) "TU5A-3" ["Title"]=> string(40) "Signal-Interference Microstrip Duplexers" ["Author"]=> string(19) "Gomez-GarciaRoberto" ["Auth_order"]=> string(9) "TU5A-3-01" ["Aff_list"]=> string(48) ""University of Spain"" ["Abstracts"]=> string(535) …

Member Avatar
Member Avatar
+0 forum 1

Hello :D I am using the twitter API to perform a search for a certain author, and storing the results in a database so that I can perfrom an action on each entry. However, there are many duplicate results that have small differences at the beginning of the string or at the end that I do not want to respond to. I have managed to select all the distinct entries based on a substring: `SELECT DISTINCT (SUBSTRING(msg_text FROM 10 FOR 75)) AS res FROM goethe_search;` ...which gives me the dinstinct substrings but not the other fields that corelate to the …

Member Avatar
Member Avatar
+0 forum 1

The string is about 3k long. It contains a substring several times with the following specification: 1. First part is FIXED number of characters. The same for all the substrings. 2. Second part is the one to be extracted and stored in an array.It is of variable length 3. Third part is FIXED number of characters. Part 1 & 3 contains all types of characters including special characters and regex metacharacters. I am attaching sort of pesudo code just to summarize my problem my @substringArray; my $longString; my $subStart="START"; my $subEnd = "END"; while (How to loop a string ???) …

Member Avatar
Member Avatar
+0 forum 4

Hi, I have made a code where I write a recipe to a file and then I can read from the file and it is output in a listbox. I need to allow the user to change the amount of people served and then the quantities change to suit the serving number. The serving number is input and the rest of the code works apart from the changing the quantities bit. The code that I am using is below. I have no idea if i'm doing it right though. Private Sub btnOKServed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles …

Member Avatar
+0 forum 0

Hey guys, i'm Working On A Project That Gets All Employees And Their Data From the User Then Saves Them in A Txt File ( Fstream ) Anyway, i figured out how to Do That But What im at stuck at now is how to search through the txt file , i figured that i got to get all the data from the txt file into the console when i start the program so i did all of that and divided all the data between < > For example : < ID > <Name > <Rank>... etc so When he …

Member Avatar
Member Avatar
+0 forum 4

Hey, I'm trying to search a List for a substring, but even if it does exist the result is coming out as negative (not present) using the BinarySearch. The idea is that once the file has been loaded into the list I search to see if substrings exist (i.e. IDS_STRING1 ) <-- includes tab. The lines in the file will say "IDS_STRING# "Something else written after tab"", but as anything could be written after the tab, that's why I need to search for the first part of the string only. The text file is in Unicode (UTF-16 LE). Can anyone …

Member Avatar
Member Avatar
+0 forum 2

Hi, I want to search a managed list, List<String^>^ list, for a variable substring (i.e. the substring changes it's contents every time it is looped). The list is populated by a Unicode (UTF-16LE) text file. The substring to be searched for is basically an ID for the Strings that occurs at the beginning of each String (the second half of the string is unknown), so I loop through and search the List for a different ID each time (i.e. IDS_STRING1, IDS_STRING2 etc.) The idea being that if it doesn't yet exist, I write it to file. I can declare the …

Member Avatar
Member Avatar
+0 forum 2

Hi,everyone My project is scanner for example. Then This is my code... [CODE]Dim htmlele As HtmlElementCollection htmlele = WebBrowser1.document.GetElementsByTagName("h3") For Each htm As HtmlElement In htmlele Dim chld As HtmlElementCollection = htm.GetElementsByTagName("a") For Each ch As HtmlElement In chld ListBox1.Items.Add(ch.GetAttribute("href")) Label1.Text = ListBox1.Items.Count & " Bulundu." Next Next[/CODE] but here want to any character then remove.. My english very bad.I'm sorry. for example [url]http://sasqas.com/sadasd=sdasd[/url] before listbox add, charackter "=" remove then listbox add ("http://sasqas.com/sadasd=") how is made? please help me... and another question if listbox in same url then don't add listbox only one url stay

Member Avatar
Member Avatar
+0 forum 2

Write the function search(word, substring) that takes in a word and a substring as arguments and returns the position (0 indexed) of the substring if it is found in the word. The function returns -1 if the substring is not found. is there a method to do this? i tried; [CODE] def search(word, substring): if substring in word: return 1 else: return -1 [/CODE] but on one of their tests it returned false, because i misunderstood the question i imagine. so how should i go about this problem? thank you for any help~

Member Avatar
Member Avatar
+0 forum 1

Hello, I'm having a problem with finding and printing an element in a vector. I want to search my vector to see if an element starts with a sub-string, and if it does, I want to write the whole string to a file. The first part is done, I just can't figure out how to write the whole string to file. Here's my code: [CODE] ifstream file1(filename); std::vector<std::string> load; for(std::string line1; getline(file1, line1); ) { load.push_back(line1); } for(int i = 1; i < 1018; ++i) { std::ostringstream integer; integer << "IDS_STRING" << i << "\t"; std::string thisString = integer.str(); bool …

Member Avatar
Member Avatar
+0 forum 2

Hi Friends how to extract following data and store in string variable. All variable are string no need to use any other data type like datetime and so on. [CODE] Deposits and Additions Date Description Amount Refe 11/01 Test1 201f13050000100 NEWEDGE 1,500,000.00 OBI:FFC SAN LAZARO, SA A/C 430 11/01 Test2 20f113050021500 VIGO RE 149.00 OBI:VIGO SETTLEMENT GTV14 11/01 Deposit 350,777.06 11/01 Opening Checking Deposit 38,097.29 11/02 Test3 20113060003600 GEORGE 350,000.00 OBI:/RFB/TO ( MULTITRADING LIM 11/02 Test4 20113060014100 1/SHARE 159,964.20 OBI:/RFB/PAYMENT OF GOODS 11/03 Test5 20113070029800 TJ HARK 52,660.00 OBI: 11/04 Test5 20113080002900 SHAREKA 80,000.00 OBI:/RFB/TO (MULTITRADING LIMI 11/04 Test6 20113080034100 …

Member Avatar
Member Avatar
+0 forum 3

For a program I'm writing, I'm trying to get rid of doubles in my string (which is a concatenation of a keyword and the alphabet). My code was compiling fine until I added the code about concatenating the substrings before and after the character I'm trying to get rid of. [code] for (int i = 0; i < fullcrypt.length(); i++) { System.out.println("i = " + i); System.out.println(fullcrypt.charAt(i)); for (int j = i+1; j <= fullcrypt.length(); j++) { System.out.println("j = " + j); System.out.println(fullcrypt.charAt(j)); //if characters match, recreate string with substrings before and after matching character if ((fullcrypt.charAt(i)) == (fullcrypt.charAt(j)) && …

Member Avatar
Member Avatar
+0 forum 7

I need some help with this. For my class I have to make a game called hexo, basically "Hexo is a game loosely based on the television game show Lingo. Rather than trying to guess 5 letter words (as in Lingo) the Hexo player will have sixteen tries to guess randomly generated 5 digit hexadecimal numbers. The hexadecimal ‘secret numbers’ will not have any duplicated digits. Each time the user enters a guess: • The number of the guess will be displayed. • The number of matching digits will be displayed. • The number of matches in the correct position …

Member Avatar
Member Avatar
+0 forum 2

I have textbox-- (texbox1)= aaa bbb ccc [COLOR="Green"]<e2>[/COLOR][COLOR="Red"]code[/COLOR][COLOR="green"]</e2>[/COLOR] aaa bbb ccc just i want (textbox2)= I want the code between <e2> and </e2> the code Where the code is a variable

Member Avatar
Member Avatar
+0 forum 4

Hi, I'm looking to code the following problem in python. If (for example) dict={A:0.7,B:0.8,C:0.9,D:2.3,E:0.1,F:2.4} and so on.. (i have a big dictionary of A-Z something like this) I'm looking to find repeated substring in a string that has a dissimilarity of no longer than 0.5 (between highest and lowest). The length of the repeated substring is provided by the user. So For example , If my string is ABCFFEABCFEBCA my answer would be ABC (with its positions), ABC(with positions in the string) and BCA(with positions in a string) (if the length of the substring provided by the user is 3) …

Member Avatar
Member Avatar
+0 forum 3

[B]Question:[/B] Write a program to read in a sentence. Output the sentence and then sort all letters in descending order. Allow users to enter a letter and output the letter with the number of occurrences of that letter, or else indicate that the letter is not found. [B][COLOR="Red"]Use: "I compute therefore I am"[/COLOR][/B] I've gotten this far with the program: [CODE]import java.io.*; class practicalTest_6{ public static void main(String args[])throws IOException{ InputStreamReader input = new InputStreamReader(System.in); BufferedReader reader = new BufferedReader(input); System.out.println("Enter a sentence:"); String sentence = reader.readLine(); System.out.println("Enter the letter to be searched:"); String search = reader.readLine(); String upperCase = …

Member Avatar
Member Avatar
+0 forum 4

Hey All, am looking for a way to break an xml Tag line into tag and attributes. Say I have This line [code=xml] <event time="12:30" value="This is a Sample Value" type="event"> </event> [/code] I have this so far [code=python] # Open file to read f=open("myTest2.xml") #start reading File for line in f: linestart=line.find("<") newline=line[linestart:len(line)] #check for XML version if newline[0:2] == "<?": print "XML version Line : "+newline #get start tag if newline[0:1] == "<" and newline[1:2] != "?": x=newline.find(" ") y=newline.find(">") if str(x) == "-1" : temp=newline[1:y] else: temp = newline[1:x] #get attribute list attributeList = newline[x:len(newline)-2] print attributeList.split(" …

Member Avatar
Member Avatar
+0 forum 1

The End.