formatting

Java: Format double with decimals

岁酱吖の 提交于 2019-12-24 09:49:12
问题 In Objective C I have been using this code to format a value so that a value with zero decimals will be written without decimals and a value with decimals will be written with one decimal: CGFloat value = 1.5; return [NSString stringWithFormat:@"%.*f",(value != floor(value)),value]; //If value == 1.5 the output will be 1.5 //If value == 1.0 the output will be 1 I need to do the same thing for a double value in Java, I tried the following but that is not working: return String.format("%.*f",

Vectorized format function for Pandas series

穿精又带淫゛_ 提交于 2019-12-24 09:18:07
问题 Say I start with a Series of unformatted phone numbers (as strings), and I would like to format them as (XXX) YYY-ZZZZ. I can get the sub-components of my input using regular expressions and str.match or str.extract . And I can perform the formatting using the result of either: ser = pd.Series(data=['1234567890', '2345678901', '3456789012']) matched = ser.str.match(r'(\d{3})(\d{3})(\d{4})') extracted = ser.astype(str).str.extract(r'(?P<first>\d{3})(?P<second>\d{3})(?P<third>\d{4})')

Google Sheets formula to change a cells value based on another cells value

假装没事ソ 提交于 2019-12-24 08:44:04
问题 I am currently muddled while trying to create a formula within Google Sheets that basically says: "If the value of cell E10 equals "Levy" then change the value of E11 cell to "Monthly" , if E10 equals anything other than "Levy" change the value of E11 to a drop down of menu "Triannual" and "Quarterly"* This is the formula I have so far which gets the first part done. I'm just stuck with creating the formula to create the drop down of the two other options if E10 = something other than the

VBA pivot table formatting based on field hierarchy

独自空忆成欢 提交于 2019-12-24 07:51:00
问题 I was tasked at work to write a macro that copies and formats a preliminary pivot table to fit the company wide branding style. The basic macro is complete but I am having trouble automating the formatting of the pivot fields based on their hierarchy and dependency. The current code looks like this Sub FormatHierarchy() 'formatting Hierarchy level 1 ActiveSheet.PivotTables(1).PivotSelect "'EBITDA category'[All]", _ xlLabelOnly + xlFirstRow, True With Selection With .Font .Name = "Arial Narrow

How to format text in html using awk

我的梦境 提交于 2019-12-24 07:49:55
问题 I would like to format my table in to html format using awk. cat table.txt COL1 COL2 COL4 COL5 COL3 BRCC hete 15869 105A 1 BRAC he 1799967 956G 1 BCAS he 7334543 369AFVC 2 RCA he 9534262 7806-14 4 RCA he 144848 1114A 5 RA he 206118 52A 5 BCAVV he 543304 3807TCD 5 BCA hoo 106091515 4308TDDSC 1 BCA hoo 206075 4563A 1 BCA hoo 799917 2612CDSA 1 BCA hoo 206076 513G 2 BCA hoom 16941 3113A 3 My awk solution: awk 'BEGIN {print "<table>"} ; { print "<tr><td width="80">" $1 "</td><td width="80">" $2 "<

VBA Excel Format Range when value is found

最后都变了- 提交于 2019-12-24 07:49:25
问题 I'm trying to implement a macro that looks for the words "TRUE" and "FALSE" in a huge array of data - and then, when found, changes the color of the cells above it. Specifically, I would like it to color not the TRUE/FALSE-cell, but the 30 cells directly above it. This is where things get tricky... I hope someone can help. I've tried adapting the below code, but mostly I'm adding it as inspiration at this point. Sub ChangeColor() lRow = Range("C" & Rows.Count).End(xlUp).Row Set MR = Range("C2

R - Export excel with formatting table in shiny

99封情书 提交于 2019-12-24 07:33:50
问题 This is a part of my code. library(shiny) library(DT) library(xlsx) #r input df <- data.frame(sd = c("A1", "A1", "A1", "A1", "A1", "A1", "A1"), rsm = c("B", "B", "B", "B", "C", "C", "C"), asm = c("D", "D", "E", "E", "F", "G", "H"), sr = c("I", "J", "K", "L", "M", "N", "O"), revenue _target = c(100, 300, 200, 300, 120, 160, 100), revenue_achive = c(80, 30, 150, 450, 20, 80, 12), revenue_perachive = c(80, 10, 75, 150, 25, 50, 12), quantites_target = c(30, 40, 60, 20, 15, 42, 30), quantities

Date Formatting Textbox

↘锁芯ラ 提交于 2019-12-24 07:29:40
问题 Is there a way to have a textbox that validates with the format dd/mm/yyyy and doesn't allow any other characters? I've managed to validate it so it's only numbers but having numbers and slashes is proving to be an issue. I am using JAVAFX . 回答1: I have created a date control which is based on a textbox: https://github.com/nablex/jfx-control-date/ It allows you to set a format (supported by SimpleDateFormat) and supports a popup for mouse selection. You can also enter values by typing (only

How to format a date from Oracle to a valid datetime in c# [duplicate]

梦想与她 提交于 2019-12-24 07:10:14
问题 This question already has answers here : C# How to parse a string of date in an arbitrary specified Oracle date format? (2 answers) Closed 5 years ago . How to format a date from Oracle to a valid DateTime in c#? So... the oracle format string is a bit different from the C# DateTime format string, so I can't use that format-string as an argument for the parse. I am using Devart/CoreLab but their OracleDate .Parse seems to be really strange and not working for me. How can I parse it correctly?

SharePoint 2007: Formatting a FormField

我们两清 提交于 2019-12-24 06:49:44
问题 I'm trying to display the page owner and last modified date on the footer of a SharePoint master page for a publishing site. On my master page I currently have: <SharePoint:FormattedString FormatText="Page owner: {0} Last updated: {1:dd/MM/yyyy}" runat="server"> <SharePoint:FormField ControlMode="Display" FieldName="PublishingContact" DisableInputFieldLabel="true" runat="server"/> <SharePoint:FormField ControlMode="Display" FieldName="Modified" DisableInputFieldLabel="true" runat="server" />