-2

i´ve got small problem and before I spend even more time in trying to solve it i´d like to know if what I want to do is even possible ( and maybe input on how to do it^^).

My problem:

I want to take some text and then split it into different strings at every whitespace (for example "Hello my name is whatever" into "Hello" "my" "name" "is" "whatever").

Then I want to set every string with it´s own variable so that I get something alike to a= "Hello" b= "my" and so on. Then I want to compare the strings with other strings (the idea is to get addresses from applications without having to search through them so I thought I could copy a telephone book to define names and so on) and set matching input to variables like Firstname , LastName and street.

Then, and here comes the "I´d like to know if it´s possible" part I want it to put it into our database, this means I want it to copy the string into a text field and then to go to the next field via tab. I´ve done something like this before with AutoIT but i´ve got no idea how to tell AutoIT whats inside the strings so I guess it must be done through the programm itself. I´ve got a little bit of experience with c++, python and BATCH files so it would be nice if anyone could tell me if this can even be done using those languages (and I fear C++ can do it and I´m just to stupid to do so). Thanks in advance.

Martin G
  • 17,357
  • 9
  • 82
  • 98
Godisalie
  • 5
  • 1
  • 1
  • i hope you can do it. But it would be easier with the new programming language like c#, java or any new languages instead of c++. – Miller Mar 17 '15 at 13:05
  • 1
    Yeah, I thought that there might be better languages but with those three I know at least kind of what I´m doing. Well, Java was on my to learn list so I guess it might be time . Thanks. – Godisalie Mar 17 '15 at 13:16

1 Answers1

0

Splitting a string is very simple, there is usually a built in method called .split() which will help you, the method varies from language to language.

When you've done a split, it will be assigned to an array, you can then use an index to get the variables, for example you'd have:

var str = "Hello, my name is Bob";
var split = str.split(" ");

print split[0]; // is "Hello,"
print split[1]; // is "my" etc

You can also use JSON to return data so you could have an output like

print split["LastName"];

What you're asking for is defiantly possible.

Some links that could be useful:

Split a string in C++?

https://code.google.com/p/cpp-json/

Community
  • 1
  • 1