TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

SOLVED: printing a year

Forums > SwiftUI

I've got a JSON file I am decoding. One of the fields contains a year, which in my model I have said its an int.

When I display it, the value shows but has a comma, eg 2,020

I do not want to display the comma.

How best should I change the code?

3      

hi,

it may depend only on how you display it.

  • Text(String(year)) should give you 2020
  • Text("\(year)") should give you 2,020

it seems that Text wants to do its own sort of localization with string interpolation (or, more precisely i think, Int does its own thing with string interpolation).

hope that helps

DMG

8      

thanks. i knew it should be something very simple

3      

Hit the same thing, and this was precisely the answer, so seconding MrG's thanks!

4      

My 8x10 photo printer setup is similar to yours. A LAN and an IoT VLAN are both available.

IoT can't communicate with LAN unless the LAN initiates the conversation, which appears to be the situation in your case (your PC on your LAN tries to talk with your printer on your IoT.)

You'll require something similar to this:

Allow Established / Related IoT to LAN

(In this case, the source is my IoT network, the destination is my LAN network, and “match state established” and “match state related” are both enabled under advanced.)

VLAN for IoT to any > Get rid of everything (Here the source is my IoT network, dest is any)

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.