Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Main {
- public static void main(String[] args) {
- System.out.println("hello world");
- System.out.println(drawTriangle(5));
- hashTweets("dahvfkl vsjlkh dshdl #slbns @bsnjklvn vndfi#vfdvns");
- }
- public static String drawTriangle(int sizetri){
- String tri = "";
- for(int i =0; i <= sizetri; i++){
- tri += "\n";
- for(int j =0; j < i; j++){
- tri += "#";
- }
- }
- return tri;
- }
- public static void hashTweets(String tweet){
- String[] tweetlist = tweet.split(" ");
- List<String> hashMentions = new ArrayList<String>();
- for (int i = 0; i < tweetlist.length; i++){
- boolean isHash = (tweetlist[i].charAt(0) == '#');
- boolean isMention =(tweetlist[i].charAt(0) == '@');
- if (isHash || isMention){
- hashMentions.add(tweetlist[i]);
- }
- }
- System.out.println(hashMentions);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement