B4J Question [B4X] [SOLVED] How to get random icon-character from FontAwesome ?

Magma

Expert
Licensed User
Longtime User
Hi there...

Thought that will be easy to get a random icon calling like that chr(rnd(0,255))... but as i see some icon are at ~32000 and others at ~65000 index...

So is there anything ready to get a random char icon from FontAwesome ?

Thanks in advance !!!
 

DonManfred

Expert
Licensed User
Longtime User
So is there anything ready to get a random char icon from FontAwesome ?
use fontawesome-list.txt from the installationfolder. this are all implemented icons.
Just take one line randomly from this file?
 
Last edited:
Upvote 1

Magma

Expert
Licensed User
Longtime User
..super... created a simple sub... (just to say that must get the first character of every line)

B4X:
Sub GetRNDIcon As String
    Dim fa As List=File.ReadList(File.DirAssets,"FontAwesomeList.txt")
    Dim getit As String = fa.Get(Rnd(1,fa.Size-2))  'better make -2 not -1 / because of last empty/space line
    Dim c As String = getit.SubString2(0,1)
    Return c
End Sub
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…