Jump to content
  • 0

Replace int with images


Question

Posted

I'm using this to convert numbers from 1 to 10 into images,

 

public final static String number(int numberid)
	{
		Map<Integer, String> number;
		number = new FastMap<Integer, String>();

		number.put(1, "<icon._num1 width=16 height=16>");
		number.put(2, "<icon._num2 width=16 height=16>");
		number.put(3, "<icon._num3 width=16 height=16>");
		number.put(4, "<icon._num4 width=16 height=16>");
		number.put(5, "<icon._num5 width=16 height=16>");
		number.put(6, "<icon._num6 width=16 height=16>");
		number.put(7, "<icon._num7 width=16 height=16>");
		number.put(8, "<icon._num8 width=16 height=16>");
		number.put(9, "<icon._num9 width=16 height=16>");
		number.put(10, "<icon._num10 width=16 height=16>");
		return number.get(numberid);
	}

 

 

is there a way to replace  each number automatically when found in string, for example : the number 123 to be converted into

"<icon._num1 width=16 height=16>"+"<icon._num2 width=16 height=16>"+"<icon._num3 width=16 height=16>"

 

3 answers to this question

Recommended Posts

  • 0
Posted
public final static String retrieveIcon(int number)
{
	return "<icon._num" + number + " width=16 height=16>";
}

About your second ask, you could parse the int 123 as a string and loop over each encountered character and refer to retrieveIcon method - if you had only one digit. Since you got potentially 2 (with "10"), it's not possible, since it will be cut to 0 and 1.

 

My example can work if you move your notation from 0 to 9 instead of 1 to 10.

 

And don't build random Map on a getter, it's terrible.

  • Like 1
  • Upvote 1
  • 0
Posted
4 hours ago, Tryskell said:

public final static String retrieveIcon(int number)
{
	return "<icon._num" + number + " width=16 height=16>";
}

About your second ask, you could parse the int 123 as a string and loop over each encountered character and refer to retrieveIcon method - if you had only one digit. Since you got potentially 2 (with "10"), it's not possible, since it will be cut to 0 and 1.

 

My example can work if you move your notation from 0 to 9 instead of 1 to 10.

 

And don't build random Map on a getter, it's terrible.

About the 2nd ask

 

public final static String retrieveIcon(int... values) 

Can do that. He just have to separate the values 

retrieveIcon(5,8,10,4,3)

  • 0
Posted (edited)
1 hour ago, melron said:

About the 2nd ask

 

public final static String retrieveIcon(int... values) 

Can do that. He just have to separate the values 

retrieveIcon(5,8,10,4,3)

 

Yes and no (the for loop isn't the problem btw :P), his ask is to cut "123" into icon1, icon2 and icon3. That's not possible with "581043", "10" will be cut "1" and "0", not "10". That's why I suggested to change his notation from 1 to 10 > 0 to 9.

 

And if you say "10" is the only number with a "0" and can be actually be parsed, then what about "11", "12", "13",... :P.

Edited by Tryskell

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Price Update on TikTok Accounts and New Products. In traffic arbitrage, TikTok accounts play a key role. The success of advertising campaigns and, consequently, the income of an arbitrager directly depend on their quality. Reliable and high-quality accounts provide stability, trust, and long-term results in promotion. With us, you will find only verified TikTok accounts suitable for launching advertising campaigns, growing audiences, and scaling profits. The right account choice is the foundation of effective arbitrage! Full assortment of our online store: Accounts: Telegram, Facebook, Reddit, Twitter (X), Instagram, YouTube, TikTok, Discord, VK, LinkedIn, GitHub, Snapchat, Gmail, mail accounts (Outlook, Firstmail, Rambler, Onet, Gazeta, GMX, Yahoo, Proton, Web.de), Google Voice, Google Ads Premium Subscriptions: Telegram Premium, Twitter Premium X, YouTube Premium, Spotify Premium, Netflix Premium, Discord Nitro, ChatGPT Plus/PRO, XBOX Game Pass Additional Services: Telegram Stars, proxies (IPv4, IPv6, ISP, Mobile), VPN (Outline, WireGuard, others), VDS/RDP servers Promo code: AUGUST2025 (10% discount) Payment: bank cards · cryptocurrency · other popular methods Relevant links: ➡ Online store: Click ➡ Telegram bot: Click ➡ SMM Panel: Click – promotion of your social media accounts Use our SMM Panel to boost Facebook, Instagram, Telegram, Spotify, Soundcloud, YouTube, Reddit, Threads, Kick, Discord, LinkedIn, Likee, VK, Twitch, Kwai, Reddit, website traffic, TikTok, Trust Pilot, Apple Music, Tripadvisor, Snapchat, and other digital products. Get $1 for the first trial run of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). Updated TikTok account assortment and price changes: TIKTOK NEW ACCOUNTS TikTok Verified Account with a Blue Checkmark | Real account with genuine followers and activity | Officially verified by TikTok. Current price: $2500. TikTok High-Quality New AutoReg Account | Country: USA and Europe | Full access (email is included) | Price from $0.2 TIKTOK - Empty(clear) autoreg accounts II CONFIRMED BY @RAMBLER.RU/@FIRSTMAIL II EMAIL INCLUDED, Registered with RU IP | Price from $0.1 Autoreg TikTok accounts II Verified through email rambler.ru, email included II Gender MIX II Latin name II Empty profile II Registered with MIX IP | Price from $0.1 ACCOUNTS WITH FOLLOWERS Autoreg TikTok accounts II 100+ followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Registered with MIX IP | Price from $0.39 Autoreg TikTok accounts II 1000+ followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Open Stream + Can insert a link II Registered with MIX IP | Price from $2.5 Autoreg TikTok accounts II 5000 followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Open Stream + Can insert a link II Registered with MIX IP | Price from $10 Autoreg TikTok accounts II 10,000+ followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Open Stream + Can insert a link II Registered with MIX IP | Price from $19 OLD ACCOUNT WITHOUT/WITH FOLLOWERS TikTok High-Quality Account | Age: 2022-2024 | Country: MIX | Full access (email is included) | Price from $0.35 TikTok Old High-Quality Account with followers: 100-10,000 (amount of followers of your choice) | Age: 2022-2024 | Country: MIX | Full access (email is included) | Price from $0.89 TIKTOK ADS TIKTOK ADS ACCOUNTS | GEO: Europe | PREPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $1 TIKTOK ADS ACCOUNTS | GEO: United States | PREPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $1 TIKTOK ADS ACCOUNTS | GEO: United States | Business Verified + POSTPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $3.5 TIKTOK ADS ACCOUNTS | GEO: Europe | Business Verified + POSTPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $3.5 TIKTOK ADS ACCOUNTS | GEO: Europe | POSTPAY+BUSINESS CENTRE | 3 advertising accounts for running ads + 1 personal | May include coupons for advertising $20-$100 | Manual Registration | Email access + Cookies + VAT Info | Price from $8 TIKTOK ADS ACCOUNTS | GEO: United States | POSTPAY+BUSINESS CENTRE | 3 advertising accounts for running ads + 1 personal | May include coupons for advertising $20-$100 | Manual Registration | Email access + Cookies + VAT Info | Price from $8 For regular clients – additional discounts and promo codes! Discount 10% – 20% or BONUS $1 for registration If you want to receive a $1 BONUS for registration OR a 10% – 20% discount on your first purchase, you can leave a comment: "SEND ME BONUS, MY USERNAME IS..." You can also use a promo code for the first purchase: SOCNET (15% discount) Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n ➡ Discord: socnet_support ➡ Discord Server: https://discord.gg/y9AStFFsrh ➡ ✉ Email: solomonbog@socnet.store Also via these contacts you can: — Consult about wholesale purchases — Establish a partnership (current partners: https://socnet.bgng.io/partners ) — Become our supplier SocNet – Digital Goods and Premium Subscriptions Store  
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchiha-market.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/4EPpYhe2HA  | https://campsite.bio/utchihaamkt
    • Price Update on TikTok Accounts and New Products. In traffic arbitrage, TikTok accounts play a key role. The success of advertising campaigns and, consequently, the income of an arbitrager directly depend on their quality. Reliable and high-quality accounts provide stability, trust, and long-term results in promotion. With us, you will find only verified TikTok accounts suitable for launching advertising campaigns, growing audiences, and scaling profits. The right account choice is the foundation of effective arbitrage! Full assortment of our online store: Accounts: Telegram, Facebook, Reddit, Twitter (X), Instagram, YouTube, TikTok, Discord, VK, LinkedIn, GitHub, Snapchat, Gmail, mail accounts (Outlook, Firstmail, Rambler, Onet, Gazeta, GMX, Yahoo, Proton, Web.de), Google Voice, Google Ads Premium Subscriptions: Telegram Premium, Twitter Premium X, YouTube Premium, Spotify Premium, Netflix Premium, Discord Nitro, ChatGPT Plus/PRO, XBOX Game Pass Additional Services: Telegram Stars, proxies (IPv4, IPv6, ISP, Mobile), VPN (Outline, WireGuard, others), VDS/RDP servers Promo code: AUGUST2025 (10% discount) Payment: bank cards · cryptocurrency · other popular methods Relevant links: ➡ Online store: Click ➡ Telegram bot: Click ➡ SMM Panel: Click – promotion of your social media accounts Use our SMM Panel to boost Facebook, Instagram, Telegram, Spotify, Soundcloud, YouTube, Reddit, Threads, Kick, Discord, LinkedIn, Likee, VK, Twitch, Kwai, Reddit, website traffic, TikTok, Trust Pilot, Apple Music, Tripadvisor, Snapchat, and other digital products. Get $1 for the first trial run of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). Updated TikTok account assortment and price changes: TIKTOK NEW ACCOUNTS TikTok Verified Account with a Blue Checkmark | Real account with genuine followers and activity | Officially verified by TikTok. Current price: $2500. TikTok High-Quality New AutoReg Account | Country: USA and Europe | Full access (email is included) | Price from $0.2 TIKTOK - Empty(clear) autoreg accounts II CONFIRMED BY @RAMBLER.RU/@FIRSTMAIL II EMAIL INCLUDED, Registered with RU IP | Price from $0.1 Autoreg TikTok accounts II Verified through email rambler.ru, email included II Gender MIX II Latin name II Empty profile II Registered with MIX IP | Price from $0.1 ACCOUNTS WITH FOLLOWERS Autoreg TikTok accounts II 100+ followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Registered with MIX IP | Price from $0.39 Autoreg TikTok accounts II 1000+ followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Open Stream + Can insert a link II Registered with MIX IP | Price from $2.5 Autoreg TikTok accounts II 5000 followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Open Stream + Can insert a link II Registered with MIX IP | Price from $10 Autoreg TikTok accounts II 10,000+ followers II Email verified @hotmail/@outlook/@firstmail/@rambler, email included in the package (working) II Gender: MIX II Latin name II Open Stream + Can insert a link II Registered with MIX IP | Price from $19 OLD ACCOUNT WITHOUT/WITH FOLLOWERS TikTok High-Quality Account | Age: 2022-2024 | Country: MIX | Full access (email is included) | Price from $0.35 TikTok Old High-Quality Account with followers: 100-10,000 (amount of followers of your choice) | Age: 2022-2024 | Country: MIX | Full access (email is included) | Price from $0.89 TIKTOK ADS TIKTOK ADS ACCOUNTS | GEO: Europe | PREPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $1 TIKTOK ADS ACCOUNTS | GEO: United States | PREPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $1 TIKTOK ADS ACCOUNTS | GEO: United States | Business Verified + POSTPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $3.5 TIKTOK ADS ACCOUNTS | GEO: Europe | Business Verified + POSTPAY | Manual Registration | Email access + Cookies + VAT Info | Price from $3.5 TIKTOK ADS ACCOUNTS | GEO: Europe | POSTPAY+BUSINESS CENTRE | 3 advertising accounts for running ads + 1 personal | May include coupons for advertising $20-$100 | Manual Registration | Email access + Cookies + VAT Info | Price from $8 TIKTOK ADS ACCOUNTS | GEO: United States | POSTPAY+BUSINESS CENTRE | 3 advertising accounts for running ads + 1 personal | May include coupons for advertising $20-$100 | Manual Registration | Email access + Cookies + VAT Info | Price from $8 For regular clients – additional discounts and promo codes! Discount 10% – 20% or BONUS $1 for registration If you want to receive a $1 BONUS for registration OR a 10% – 20% discount on your first purchase, you can leave a comment: "SEND ME BONUS, MY USERNAME IS..." You can also use a promo code for the first purchase: SOCNET (15% discount) Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ Telegram Channel: https://t.me/accsforyou_shop ➡ WhatsApp: https://wa.me/79051904467 ➡ WhatsApp Channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n ➡ Discord: socnet_support ➡ Discord Server: https://discord.gg/y9AStFFsrh ➡ ✉ Email: solomonbog@socnet.store Also via these contacts you can: — Consult about wholesale purchases — Establish a partnership (current partners: https://socnet.bgng.io/partners ) — Become our supplier SocNet – Digital Goods and Premium Subscriptions Store  
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchiha-market.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/4EPpYhe2HA  | https://campsite.bio/utchihaamkt
    • Discord         :  utchiha_market Telegram        : https://t.me/utchiha_market Auto Buy Store  : https://utchiha-market.mysellauth.com/ Not sure if we’re legit? Check Our server — real reviews, real buyers https://discord.gg/4EPpYhe2HA  | https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock