MCPcopy Create free account
hub / github.com/DentonW/DevIL / conv

Method conv

DevIL-docs/DocBuilder.java:627–658  ·  view source on GitHub ↗
( String str )

Source from the content-addressed store, hash-verified

625 // [/link:<GROUP>:<NAME>] --> [/link:IL:ilBindImage]
626 // [/extlink:<LINK>] --> [/extlink:http://www.foo.com]
627 public static String conv( String str ) {
628 try {
629 int idx = 0;
630
631 // ogni vettore e' un vettore
632 // 1 -> string to match
633 // 2 -> pre param
634 // 3 -> post param
635 String tags[][] =
636 {{"%link:","<a href=\"","\" />"},
637 {"%br","</br>",""},
638 {"%center/","</center>",""},
639 {"%center","<center>",""},
640 {"%img:","<img src=\"","\" />"}};
641
642 for( int ctr = 0; ctr < tags.length; ctr++ ) {
643 int ret = 0;
644 while( (ret = find(str,ret,tags[ctr][0])) != -1 ) {
645 int end_idx = find(str,ret+tags[ctr][0].length()-2,"%");
646 String pre = str.substring(0,ret);
647 String post = str.substring(end_idx+1,str.length());
648 str = pre + tags[ctr][1] +str.substring(ret+(tags[ctr][0]).length(),end_idx) + tags[ctr][2] + post;
649 ret = end_idx;
650 }
651 }
652 } catch( Exception e ) {
653 System.err.println("Error while elaborating a tag");
654 e.printStackTrace();
655 System.exit(-1);
656 }
657 return str;
658 }
659
660
661 // Find utility functions

Callers 1

workMethod · 0.95

Calls 1

findMethod · 0.95

Tested by

no test coverage detected