From 04f485071299c81475fe0897f3c2e31d7158134e Mon Sep 17 00:00:00 2001 From: Gaurav Date: Sun, 10 Jan 2021 10:27:09 +0530 Subject: [PATCH] Add link for reverse string and string to int videos in respective blogs --- _posts/java-string/2019-12-02-reverse-a-string-in-java.md | 5 +++++ _posts/java-string/2020-01-05-convert-string-to-int.md | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/_posts/java-string/2019-12-02-reverse-a-string-in-java.md b/_posts/java-string/2019-12-02-reverse-a-string-in-java.md index 4577d2d..a797f06 100644 --- a/_posts/java-string/2019-12-02-reverse-a-string-in-java.md +++ b/_posts/java-string/2019-12-02-reverse-a-string-in-java.md @@ -79,6 +79,7 @@ Output: ```java The reversed string of the 'coderolls.com' is: moc.slloredoc ``` + #### Note: In the `for` loop, I have assigned `blogName.length()-1` to i instead of `blogName.length()` because the characters in the string are indexed from 0. @@ -86,6 +87,10 @@ I have given an image below to show the string indexing. ![Showing indexes of the characters in the string.](/assets/images/2019-12-02/string-indexing.png) +Also you can watch [the video on my youtube channel for reverse a string with the above method](https://www.youtube.com/watch?v=vrTYrQuB0BE). + +[![How To Reverse A String In Java](https://img.youtube.com/vi/vrTYrQuB0BE/0.jpg)](https://www.youtube.com/watch?v=vrTYrQuB0BE "How To Reverse A String In Java") + ## 2. Using `getBytes()` method of String In the `getBytes()` method of Java String first encodes the specified string into the sequence of bytes using the platforms default charset and then save the result in the byte array. The same byte array will be returned. ```java diff --git a/_posts/java-string/2020-01-05-convert-string-to-int.md b/_posts/java-string/2020-01-05-convert-string-to-int.md index 2b87ae9..13594c5 100644 --- a/_posts/java-string/2020-01-05-convert-string-to-int.md +++ b/_posts/java-string/2020-01-05-convert-string-to-int.md @@ -22,6 +22,10 @@ I have listed down two ways to convert a String into an Integer. 1. Using the `Integre.parseInt()` method 2. Using the `Integer.valueOf()` method +You can watch [the video on my youtube channel for "How To Convert A String To An Integer In Java"](https://www.youtube.com/watch?v=pNHjvpNHVCs). + +[![How To Convert A String To An Integer In Java](https://img.youtube.com/vi/pNHjvpNHVCs/0.jpg)](https://www.youtube.com/watch?v=pNHjvpNHVCs "How To Convert A String To An Integer In Java") + Now we will see the above ways to convert string to integer one by one. ## Using the `Integre.parseInt()` method @@ -85,7 +89,7 @@ Output 134 ``` -## Let us know about `NumberFormatException` +## A Note about `NumberFormatException` When you are trying to convert a string to integer but your string contains a value other than the decimal digits, then bothe the methods (`Integre.parseInt()` method and `Integer.valueOf()` method) will throw the `NumberFormatException`.