reverse

reversing only certain words of a string

笑着哭i 提交于 2020-01-11 13:11:09
问题 I have a string with the name "Mustang Sally Bob" After i run my code i want the string output to be like this: gnatsuM yllaS boB My approach is to count the words until the space and save the index of where the space is located in the string. then Then I want to print the characters starting from the space backwards. #include <stdio.h> int main() { char* test="Mustang Sally Bob"; int length; //string length int x; for(length=0;test[length] !=0&&test[length];length++); //get string length int

Parse Jar file and find relationships between classes?

微笑、不失礼 提交于 2020-01-11 11:34:09
问题 How to detect whether the class from the jar file is extending other class or if there are method calls to other class objects or other class objects are created ? and then system out which class extend which class and which class called methods from which class . Im using Classparser to parser the jar . here is part of my code : String jarfile = "C:\\Users\\OOOO\\Desktop\\Sample.Jar"; jar = new JarFile(jarfile); Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements())

How to reverse an array using the Reverse method. C# [closed]

狂风中的少年 提交于 2020-01-11 07:23:26
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . For some reason when I apply the reverse method, nothing changes. public static string ReverseString(string word) { char[] myArray = word.ToCharArray(); myArray.Reverse(); string ans = string.Join("", myArray); return ans; } 回答1: Try Array.Reverse(myArray) instead of myArray.Reverse() . You are confusing

c program for the reverse the digits

荒凉一梦 提交于 2020-01-11 04:15:07
问题 I am looking for the C program for reverse the digits like below: If i enter: 123456 Then the result would be: 654321 Please help me. 回答1: Use % 10 to get the last digit. Output it. Divide the number by 10 to get all but the last digit. Use % 10 to get the last digit of that. And so on, until the number becomes 0. 回答2: Here is a simple solution to this complex problem: #include <stdio.h> int main() { int ch; ch = getchar(); if (ch != '\n') { main(); printf("%c", ch); } } A new version that

A ref or out argument must be an assignable variable

与世无争的帅哥 提交于 2020-01-10 04:12:08
问题 I'm coding an application which can make a reverse proxy connection but I have a problem! The error is here: new Form1.ProxyConfig() When I try to run it I get an error: " A ref or out argument must be an assignable variable " private void startToolStripMenuItem_Click(object sender, EventArgs e) { if (this.startToolStripMenuItem.Text == "Start") { var form2 = new Form2(); if (form2.ShowDialog() != DialogResult.OK) return; int num1 = Form1.ProxyListenerStart(ref new Form1.ProxyConfig() {

How to traverse Linked Hash Map in reverse? [duplicate]

感情迁移 提交于 2020-01-09 07:16:47
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Iterating through a LinkedHashMap in reverse order How to traverse Linked Hash Map in a reverse order? Is there any predefined method in map to do that? I'm creating it as follows: LinkedHashMap<Integer, String> map = new LinkedHashMap<Integer,String>(); map.put(1, "one"); map.put(2, "two"); map.put(3, "three"); 回答1: List<Entry<Integer,String>> list = new ArrayList<>(map.entries()); for( int i = list.size() -1;

Python list sort in descending order

倾然丶 夕夏残阳落幕 提交于 2020-01-08 09:30:53
问题 How can I sort this list in descending order? timestamp = [ "2010-04-20 10:07:30", "2010-04-20 10:07:38", "2010-04-20 10:07:52", "2010-04-20 10:08:22", "2010-04-20 10:08:22", "2010-04-20 10:09:46", "2010-04-20 10:10:37", "2010-04-20 10:10:58", "2010-04-20 10:11:50", "2010-04-20 10:12:13", "2010-04-20 10:12:13", "2010-04-20 10:25:38" ] 回答1: In one line, using a lambda : timestamp.sort(key=lambda x: time.strptime(x, '%Y-%m-%d %H:%M:%S')[0:6], reverse=True) Passing a function to list.sort : def

copy else statement to if statement

倾然丶 夕夏残阳落幕 提交于 2020-01-07 03:24:09
问题 I am trying to copy the code of else state to the if statement. In here I see if-eqz as the if condition but I don't know where the else condition is here. Can someone help me find else condition so that I can copy it to become the if code also. I also want to know where is the start and the end of the else statement body if-eqz v1, :cond_1 .line 103 :goto_1 return-object v0 .line 82 :cond_0 invoke-static {}, Landroid/os/Environment;->getExternalStorageDirectory()Ljava/io/File; move-result

SQL - Why isn't there a way to SELECT ALL, except this column

老子叫甜甜 提交于 2020-01-06 03:35:41
问题 My general question is that I want to select all columns from a left join, and I don't need to know the ID that joins the two tables. I know that it is unnecessary to select all, but since you need all the fields except the ids, why isn't there a shorter way to: SELECT * except "this column", i feel like the action time should be shorter by doing the reverse way? T1: aID, c1, c2, c3, c4 t2: aID, c1, c2, c3, c4 Select * from t1 left join t2 on t1.aid = t2.aid result: t1:aid, c1, c2, c3, c4,

I am trying to reverse a two dimensional array and keep getting a null exception

拈花ヽ惹草 提交于 2020-01-06 02:16:28
问题 Here is my method that is suppose to reverse the array. (Also, keep in mind that this method can receive a jagged array) public static int[][] reverse(int[][]a){ int[][] rev = new int[a.length][]; int row = a.length; for(int x=0;x<a.length;x++){ int col = a[x].length-1; for(int y=0; y< a[x].length;y++){ rev[row-1][col-1]= a[x][y]; col--; } row--; } return rev; }// reverse method I keep getting Exception in thread "main" java.lang.NullPointerException at Home.reverse(Home.java:259) at Home